Thread: need help nob

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    96

    need help nob

    hi i have a structure and i want to pass it to the function i cannot get any value
    can someone please hellp me

    Code:
    #include<stdio.h>
    #include<conio.h>
    #include<stdlib.h>
    #include<string.h>
    void menu(struct student info);
    
    struct student
    {
           int gpa;
           char name[30];      
    };
    
    main()
    {     int i=0;
          int count;
          struct student info;      
          
          printf("enter gpa");
          scanf("%i",info.gpa);
          
          menu(info);
          
          getch();
          
    }
    void menu(struct student info)
    {
         printf("%i",info.gpa);
    
    }

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    If you increase your compiler's warning level you would probably get a warning telling you that something is wrong with the scanf.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    96
    nicxe

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. nob question super easy
    By joker_tony in forum C Programming
    Replies: 4
    Last Post: 03-28-2008, 11:06 PM
  2. nob question True or false
    By joker_tony in forum C Programming
    Replies: 1
    Last Post: 03-08-2008, 01:01 PM