#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 |
write a program in c to merge two array
Design an implement of the inputs functions for event mode
#define max 5 #define int arr1[max] main() { typedef char arr2[max]; arr1 list={0,1,2,3,4}; arr2 name="name"; printf("%d %s",list[0],name); }
main() { char *p="GOOD"; char a[ ]="GOOD"; printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d", sizeof(p), sizeof(*p), strlen(p)); printf("\n sizeof(a) = %d, strlen(a) = %d", sizeof(a), strlen(a)); }
main() { int i=5; printf("%d",++i++); }
Cluster head selection in Wireless Sensor Network using C programming language.
main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }
void main() { int *i = 0x400; // i points to the address 400 *i = 0; // set the value of memory location pointed by i; }
how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.
0 Answers Mbarara University of Science and Technology,
main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }
Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange
main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }