Structures

+1 Ossama Memon · December 28, 2015
Guys whenever I run my code of structures I always get this freaking thing. 
I copied the code of bucky.
/images/forum/upload/2015-12-28/a10e0780db6b5a9872e1861c0fa5a708.PNG

Post a Reply

Replies

Oldest  Newest  Rating
0 Ossama Memon · December 30, 2015
Krootushas Gesu Your idea worked. I made 2 char arrays and now it's working. Thank you and thanks to all of you who replied me.
0 Linguist Llama · December 30, 2015
It's worth noting that your compiler is probably warning you about this problem... You should pay more attention to warnings.
0 chinesh doshi · December 29, 2015
then what is the problem ?
0 Ossama Memon · December 29, 2015
Chinesh look i've introduced #include "structuresinfo.h" above. This is my code.

#include <stdio.h>
#include <stdlib.h>
#include "structuresinfo.h"

The main code

int main()
{
    struct user ossama;
    struct user ali;
    ossama.userID = 1;
    ali.userID = 2;
    puts("Enter the first Name of user 1");
    gets(ossama.firstName);
    puts("Enter the first Name of user 2");
    gets(ali.firstName);
    printf("User 1 ID is %d \n", ossama.userID);
    printf("User 2 first name is %s \n", ali.firstName);
}

Another page's code and the name of this page is structuresinfo.h

struct user{
    int userID;
    char firstName;
    char lastName;
    int age;
    float weight;
};
0 Linguist Llama · December 29, 2015
Please stop guessing, chinesh.
0 chinesh doshi · December 28, 2015
may be that header file which you are including in your program may not be present in your library.
0 Laura Lee · December 28, 2015
Show the code so we can actually see what's wrong.
  • 1

C

107,336 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator