#include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s;
printf("%d",s->x);
printf("%s",s->name);
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
Compiler Error
Explanation:
You should not initialize variables in declaration
| Is This Answer Correct ? | 10 Yes | 3 No |
Answer / anand
Compilation error
you should not iniialize the structure variable inside the
declaration.
| Is This Answer Correct ? | 4 Yes | 2 No |
There is no syntax error.
Pointer s is declared but never initialized.
Using uninitialized pointer , trying to access members(x and name) of structure results in invalid access of memory.
Hence segmentation fault.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;
main() { struct date; struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }
main() { { unsigned int bit=256; printf("%d", bit); } { unsigned int bit=512; printf("%d", bit); } } a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error
main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }
print a semicolon using Cprogram without using a semicolon any where in the C code in ur program!!
35 Answers Tata Elxsi, TCS, VI eTrans,
main() { char *p; p="%d\n"; p++; p++; printf(p-2,300); }
how to concatenate the two strings
write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).
0 Answers CDAC, College School Exams Tests,
‎#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }
What is the output for the program given below typedef enum errorType{warning, error, exception,}error; main() { error g1; g1=1; printf("%d",g1); }
String reverse with time complexity of n/2 with out using temporary variable.
PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1