Thread: Errors with structures...

  1. #1
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002

    Errors with structures...

    Hi, This program for some reason generates errors..........why? But when i used a variable as a 'middle-person' to assign the input to it first then assighn the input to the structure member and printing it it's ok. Why ?


    #include <stdio.h>
    struct integer {
       char c;
       short s;
       int i;
       long b;
    int main()
       struct integer number;
       scanf( "%d", number.i );
       printf( "%d", number.i );
       return 0;

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    scanf() takes the address of the variable -

    scanf( "%d", &number.i );

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Structures within structures for a database
    By Holtzy in forum C Programming
    Replies: 2
    Last Post: 04-30-2008, 07:06 AM
  2. global namespace errors
    By stubaan in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 03:11 PM
  3. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 10:50 AM
  4. Header File Errors...
    By Junior89 in forum C++ Programming
    Replies: 5
    Last Post: 07-08-2007, 12:28 AM
  5. executing errors
    By s0ul2squeeze in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2002, 01:43 PM