By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 1,099 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

struct in c

P: 18
help pls why do i get Error 10 error C4700: uninitialized local variable 'question1' used when i run this program!!!??

Expand|Select|Wrap|Line Numbers
  1. #pragma warning(disable:4996)
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4.  
  5. #define Get_The_max 70
  6. struct question{
  7.     char *questions;
  8.     char *alter1;
  9.     char *alter2;
  10.     char *alter3;
  11.     char *alter4;
  12.     char correct;
  13. };
  14.  
  15.  
  16.  
  17. int main(){
  18.  
  19.     char *m;
  20.     struct question question1;
  21.     struct question Alt1;
  22.  
  23.     question1.questions[Get_The_max] = "what is my name?A:Haidar?B:Ali?C:Hagob?D:Aws?";
  24.     Alt1.alter1 = 'A';
  25.     Alt1.alter2 = 'B';
  26.     Alt1.alter3 = 'C';
  27.     Alt1.alter4 = 'D';
  28.     Alt1.correct;
  29.     m = question1.questions[Get_The_max];
  30.     printf("%s\n", *m);
  31.     scanf("%c", &Alt1.correct);
  32.  
  33.     if (Alt1.correct == Alt1.alter1);
  34.     {
  35.         print("right you have won\n");
  36.     }
  37.  
  38.     if ((Alt1.correct) != Alt1.alter1); {
  39.  
  40.         printf("sorry\n");
  41.     }
  42.  
  43.  
  44.  
  45.     system("pause");
  46. }
Nov 21 '15 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
I get over a dozen errors using Visual Studio 2013 but your reported error is not one of them.

Whose compiler are you using?
Nov 22 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.