0% found this document useful (0 votes)
34 views54 pages

String 1

The document contains a series of C programming code snippets that demonstrate various string manipulation techniques and functions. Each snippet illustrates different aspects of string handling, such as concatenation, copying, and printing, as well as the use of string literals and character arrays. The examples also highlight potential issues and behaviors in C related to strings, such as null-termination and memory management.

Uploaded by

Syed Tahaseen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views54 pages

String 1

The document contains a series of C programming code snippets that demonstrate various string manipulation techniques and functions. Each snippet illustrates different aspects of string handling, such as concatenation, copying, and printing, as well as the use of string literals and character arrays. The examples also highlight potential issues and behaviors in C related to strings, such as null-termination and memory management.

Uploaded by

Syed Tahaseen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

Strings

1) int main()
{
char str1[20] = "ashok", str2[20] = "linux";
printf("%s\n", strcpy(str2, strcat(str1, str2)));
return 0;
}

2) #include<stdio.h>

int main()
{
char p[] = "%c\n";
p[1] = '%';
printf(p,77);
return 0;
}

3) int main()
{
printf("%d\n", strlen("ashok"));
return 0;
}

4) int main()
{
char str[] = "vector\0\Bindia\0";
printf("%s\n", str);
return 0;
}

5) int main()
{
printf("vector", "INDIA\n");
return 0;
}

6) int main()
{
char str[7] = "vectorchennai";
printf("%s\n", str);
return 0;
}
7) int main()
{
char str[] = "chennai\0\Bvector\0";
printf("%d\n", strlen(str));
return 0;
}

8) int main()
{
static char str1[] = "Msd";
static char str2[20];
static char str3[] = "Rohit";
int i;
i = strcmp(strcat(str3, strcpy(str2, str1)), "RohitMsd");
printf("%d\n", i);
return 0;
}

9) int main()
{
static char s[] = "ashok!";
printf("%d\n", *(s+strlen(s)));
return 0;
}

10) int main()


{
static char s[25] = "The vector india";
int i=0;
char ch;
ch = s[++i];
printf("%c", ch);
ch = s[i++];
printf("%c", ch);
ch = i++[s];
printf("%c", ch);
ch = ++i[s];
printf("%c", ch);
return 0;
}
11) int main()
{
int i;
char a[] = "\0";
if(printf("%s", a))
printf("all are best\n");
else
printf("i am the best\n");
return 0;
}

12) int main()


{
char a[] = "c module";
char *b = "C++ Module";
printf("%d, %d\n", sizeof(a), sizeof(b));
printf("%d, %d\n", sizeof(*a), sizeof(*b));
return 0;
}

13) int main()


{
char str1[] = "ashok";
char str2[10];
char *t, *s;
s = str1;
t = str2;
while(*t=*s)
*t++ = *s++;
printf("%s\n", str2);
return 0;
}

14) int main()


{
char str[] = "Believe\0in\0yourself\0";
printf("%d\n", sizeof(str));
return 0;
}

15) int main()


{
char str[25] = "Divine";
printf("%s\n", &str+2);
return 0;
}
16) int main()
{
char str = "iluvindia";
printf("%s\n", str);
return 0;
}

17) int main()


{
char str[] = "ashok";
str[0]='V';
printf("%s, ", str);
str = "Vector";
printf("%s", str+1);
return 0;
}

18) int main()


{
char sentence[80]="Follow your goals";
int i;
// scanf("%s",sentence);
for(i=strlen(sentence)-1; i >=0; i--)
putchar(sentence[i]);
return 0;
}

19) int main()


{
char *str1 = "ashok";
char *str2 = "linux";
char *str3;
str3 = strcat(str1, str2);
printf("%s %s\n", str3, str1);
return 0;
}

20) int main()


{
char str1[5]="vector", str2[5]="vectoa";
int i;
i = strcmp(str1, str2);
printf("%d\n", i);
return 0;
}
21) int main()
{
printf("%u %s\n", &"Hello1", &"hai");
return 0;
}

22) int main()


{
char Str[1000]="Expect the unexpectded";
int i;
for (i = 0; Str[i] != '\0'; ++i);

printf("Length of Str is %d", i);

return 0;
}

23) #include <stdio.h>


int main()
{
printf("%s\n",4+"Hello world");
printf("%s\n","Hello world"+4);
return 0;
}

24) #include <stdio.h>


#include <string.h>

int main()
{
char str[10]="Hello";

str[strlen(str)+1]='#';
printf("str= %s\n",str);

return 0;
}

25) int main()


{
char str[]={0x41,0x42,0x43,0x20,0x44,0x00};
printf("str= %s\n",str);
return 0;
}
26) int main()
{
char str[]="india";
char *ptr=str;

while(*ptr!='\0')
printf("%c",++*ptr++);

printf("\n");

return 0;
}

27) int main()


{
char str[5]={0},loop=0;

while(loop<5)
printf("%02X ",str[loop++]);
printf("\n");

return 0;
}

28) int main()

char *str = "hello, world";

char *str1 = "hello, world";

if (strcmp(str, str1))

printf("equal");

else

printf("unequal");

}
29) int main()

char *str = "hello, world";

char str1[15] = "hello wo 9";

strcpy(str, str1);

printf("%s", str1);

30) int main()

char *str = "hello, world";

char str1[9];

strncpy(str1, str, 9);

printf("%s %d", str1, strlen(str1));

31) int main()

char *str = "hello, world\n";

printf("%d", strlen(str));

}
32) int main()

char str[11] = "hello";

char *str1 = "world";

strcat(str, str1);

printf("%s %d", str, str[10]);

33) int main()

char str[10] = "hello";

char *str1 = "world";

strncat(str, str1, 9);

printf("%s", str);

34) main()
{
const char str1[]="ABCDEF1234567";
const char str2[] = "269";
int len = strcspn(str1, str2);
printf("Ashok=%d\n", len + 1);
}

35) int main()


{
char ch = 'A';
printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f));
return 0;
}

36) int main()


{
printf("%c\n", "abcdefgh"[4]);
return 0;
}
37) int main()
{
char str[20]="Follow your passion";
char *s;
s=str;
while(*s != '\0')
{
if(*s >= 97 && *s <= 122)
*s = *s-32;
s++;
}
printf("%s",str);
return 0;
}

38) #include<stdio.h>
#include<string.h>

int main()
{
char str1[20] = "Hello", str2[20] = " World";
printf("%s\n", strcpy(str2, strcat(str1, str2)));
return 0;
}

39) int main()


{
char p[] = "%d\n";
p[1] = 'c';
printf(p, 65);
return 0;
}

40)
int main()
{
printf(5+"Gud Morning\n");
return 0;
}

41) int main()


{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
42) int main()
{
char str[]={'g','l','o','b','y','\0'};
printf("%s",str);
return 0;
}

43) int main()


{
int str[]={'g','l','o','b','y'};
printf("A%c ",str);
printf("A%s ",str);
printf("A%c ",str[0]);
return 0;
}

44) int main()


{
char str1[]="JOHN";
char str2[20];
str2= str1;
printf("%s",str2);
return 0;
}

45) int main()


{
char country[]="BRAZIL";
char *ptr;
ptr=country;
while(*ptr != '\0')
{
printf("%c", *ptr);
ptr++;
}
return 0;
}

46) int main()


{
char *p1 = "GOAT";
char *p2;
p2 = p1;
printf("%s", p2);
}
47) int main()
{
char *p1 = "GOAT";
char *p2;
p2 = p1;
p2="ANT";
printf("%s", p1);
}

48) int main()


{
char p[] = "ZILLA";
int i=0;
while(p[i] != '\0')
{
printf("%c",*(p+i));
i++;
}
}

49) int main()


{
char str[]="Hello%s%dFriends";
printf(str);
printf("\n");
printf("%s",str);
return 0;
}

50) int main()


{
int i;
char str[]="Borntowin";
for(i=0;str[i]!='\0';i++)
{
putchar(str[i]);
putchar('*');
}
return 0;
}

51) int main()


{
char str[]="value is =%d";
int a='7';
str[11]='c';
printf(str,a);
return 0;
}
52) int main()
{
char result,str[]="\0w3schools";
result=printf("%s",str);
if(result)
printf("TRUE");
else
printf("FALSE");
return 0;
}

53) int main()


{
if( printf("Hello") == strlen("Hello") )
printf("Friends");
else
printf("Enemies");
return 0;
}

54) int main()


{
char s1[]="haihello";
char s2[7];

strncpy(s2,s1,8);
printf("%s\n",s2);
return 0;
}

55) int main()


{
char *str="hai";
while(*str)
printf("%s\n",str++);
return 0;
}

56) int main()


{
string myName="embeddedsystem";
printf("My name is =%s",myName);
return 0;
}
57) int main(){
char str[]="Reebok";

while(str+strlen(str))
printf("*");
return 0;
}

58) main()
{
char c[] = "vector2020";
char *p =c;
printf("%c %c\n", *p,*(p+p[3]-p[1]));
}

59) #include<stdio.h>
main()
{
char p[20];
char *s = "string";
int length = strlen(s);
int i;
for (i = 0; i < length; i++)
p[i] = s[length-i];
printf("%s",p);
printf("hai\n");
}

60) main()
{
char c[] = "inda2020";
char *p =c;
printf("%s", p + p[3] - p[1]) ;
}

61) #include<stdio.h>

int main()
{
char p[] = "%c\n";
p[1] = '%';
printf(p, 77);
return 0;
}
62) #include<stdio.h>

int main()
{
char p[] = "%%\n";
p[0] = '/';
printf(p[0], 'A');
return 0;
}

63) #include<stdio.h>

int main()
{
char p[] = "%f\n";
p[0] = 'f';
p[0++];
printf(p[0], 'Z');
return 0;
}

64) #include<stdio.h>

int main()
{
char p[] = "%f\n";
p[0] = 'f';
if(1)
//p[0++];
printf(p, 'Z');
return 0;
}

65) #include<stdio.h>

int main()
{
char p[] = "%f\n";
p[0] = 'f';
if(!!1)
//p[0++];
printf(p, 'Z');
return 0;
}
66) #include<stdio.h>

int main()
{
printf("welcome");
char p[] = "%f\n";
p[0] = 'f';
if(!!1&&1)
return;
printf(p, 'Z');
return 0;
}

67) #include<stdio.h>
int main()
{
printf("vector");
char p[] = "%f\n";
p[0] = 'f';
if(~0)
printf(p+1, 'Z');
return 0;
}

68) #include<stdio.h>
int main()
{
printf("vector");
char p[] = "%s\n";
p[0] = 's';
if(~0&&~1)
printf(p+2, 'A');
return 0;
}

69) #include<stdio.h>
int main()
{
printf("vector");
char p[] = "%s\n";
p[0] = 's';
if(~0||~1)
printf(p+2, 'A');
return 0;
}
70) #include<stdio.h>
int main()
{
char p[] = "%s\n";
p[1] = 'S';
if(p[0])
printf(p,'1');
return 0;
}

71) int main()


{
printf(1+"%d\n", strlen("ashok"));
return 0;
}

72) int main()


{
printf(5+"%dvector\n", strlen("ashok"));
return 0;
}

73) int main()


{
printf(5+"%d%d%dvector\n", strlen("ashok"));
return 0;
}

74) int main()


{
printf("%d%d%dvector\n"+5, strlen("ashok"));
return 0;
}

75) int main()


{
printf("%f\n"+1, strlen("ashok"));
return 0;
}

76) int main()


{
printf("%u\n"+01, strlen("ashokleyland"));
return 0;
}
77) int main()
{
printf("%llu\n"+0.111, strlen("ashokleyland"));
return 0;
}

78) int main()


{
printf("%%%%\n"+0, strlen("ashokleyland"));
return 0;
}

79) int main()


{
printf("////\n"+0.0, strlen("ashokleyland"));
return 0;
}

80) int main()


{
printf("\n"+'49', strlen("ashokleyland"));
return 0;
}

81) int main()


{
char str[] = "vector\c\cindia\0";
printf("%s\n", str);
return 0;
}

82) int main()


{
char str[] = "vector\\d\\dindia\0";
printf("%s\n", str);
return 0;
}

83) int main()


{
char str[] = "vector\\r\\india\0";
printf("%s\n", str);
return 0;
}
84) int main()
{
char str[] = "hi\rvectorindia\0";
printf("%s\n", str);
return 0;
}

85) int main()


{
char str[] = "hi\rvector\rindia\0";
printf("%s\n", str);
return 0;
}

86) int main()


{
char str[] = "hi\\bvector\rindia\0";
printf("%s\n", str);
return 0;
}

87) int main()


{
char str[] = "hi\\bvector\r\s\india\0";
printf("%s\n", str);
return 0;
}

88) int main()


{
char str[] = "\rexit\r\0";
printf("%s\n", str);
return 0;
}

89) int main()


{
char str[] = "\bexit\b\0";
printf("%s\n", str);
return 0;
}

90) int main()


{
char str[] = "\aexit\a\0";
printf("%s\n", str);
return 0;
}
91) int main()
{
printf("vector", "INDIA,"chennai"\n");
return 0;
}

92) int main()


{
char str[7] = "vector\0chennai";
printf("%s\n", str);
return 0;
}

93) int main()


{
char str[7] = "vecto\0r\rchennai";
printf("%s\n", str);
return 0;
}

94) int main()


{
char str[7] = "\0vecto\0r\rchennai";
printf("%d\n", str);
return 0;
}

95) int main()


{
char str[7] = "vectorchennai";
printf("%s\n", str[0]);
return 0;
}

96) int main()


{
char str[7] = "vectorchennai";
printf("%c\n", str[0]);
return 0;
}

97) int main()


{
char str[7] = "vectorchennai";
printf("%c\n", ++str[0]);
return 0;
}
98) int main()
{
char str[7] = "vectorchennai";
printf("%c\n", str[0]++);
return 0;
}

99) int main()


{
char str[7] = "vectorchennai";
printf("%c\n", ++str[0]++);
return 0;
}

100) int main()


{
char str[] = "vectorchennai";
printf("%d\n", str);
return 0;
}

101) int main()


{
char str1[] = "VectorIndia";
char str2[] = {'a', 's', 'h', 'o', 'k', 'l', 'i', 'n', 'u','x'};
int n1 = sizeof(str1)/sizeof(str1[0]);
int n2 = sizeof(str2)/sizeof(str2[0]);
printf("n1 = %d, n2 = %d", n1, n2);
return 0;
}

102) int main()


{
char str[] = "Discover";
printf("%s %s %s\n", &str[5], &5[str], str+5);
printf("%c %c %c\n", *(str+6), str[6], 6[str]);
return 0;
}

103) int main()


{
char arr[] = "LiveHappy";
printf("%s", (arr+4));
return 0;
}
104) #include<stdio.h>
int main()
{
char str[20] = "Doyourbest";
printf ("%d", sizeof(str));
return 0;
}

105) int main()


{
char str[20] = "AllisWell";
printf ("%d", strlen(str));
return 0;
}

106) main()
{
char s[]= "string";
int length = strlen(s);
int i;
for (i = 0; i < length; i++)
printf("%c", s[i]);
}

107) main()
{
char str1[] = "positivity";
if(printf("%d\n",sizeof(str1)) )
{
printf("if u win\n");
}
else
{
printf("no one win\n");
}
}

108) int main()


{
char str[] = "%d %c", arr[] = "hellohai";
printf(str, 0[arr], 2[arr + 3]);
return 0;
}
109) int main()
{
char str1[]="vector", str2[]="india";
int i;
strcat(str2,str1);
printf("%s\n",str2);
return 0;
}

110) int main()


{
char str1[]="vector", str2[]="india";
int i;
strcat(str1,str2);
printf("%s\n",str1);
return 0;
}

111) int main()


{
char str1[50]="abc", str2[50];
strcpy(str2, strrev(str1));
printf("Reverse string is : %s",str2);
return 0;
}

112) main()
{
char str[]="Clock";
printf("%.3s\n",str);
}

113) main()
{
char str[]="sklinux";
printf("%1.3s\n",str);
}

114) main()
{
char str[]="sklinuxchennai";
printf("%7.2s\n",str);
}

115) main()
{
char str[]="sklinuxbanglore";
printf("%0.2s\n",str);
}
116) main()
{
char x[]="hi";
char y[]="hello";
printf("%s",x+y);
}

117) main()
{
char sport[]="cricket";
int x=1,y;
y=x++ + ++x;
printf("%c",sport[++y]);
}

118) main()
{
char p[]="star",q[10];
strcpy(q,p);
printf("%s,%s","ashok",q);
}

119) main(){
char name[]="India";
int i;
for(i=0;i<strlen(name);i+=2){
printf("%c",name[i]);
}
}

120) main()
{
char str[]="C For Swimmers";
printf("%.5s\n",str);
}

121) main()
{
char line[80]="Dear Friends";
printf("%1.2s",line);
}

122) main()
{
char *str="NULL";
strcpy(str,"Cquestionbank");
printf("%s",str);
}
123) main()
{
char a[]="India";
char *p="BITS";
a="BITS";
p="India";
printf("%s %s",a,p);
}

124) main()
{
char *x="HELLO";
x+=3;
printf("%s",x);
}

125) int main()


{
int i;
char str[]="Borntowin";
for(i=0;str[i]!='\0';i++)
{
break;
putchar(str[i]);
putchar('*');
}
printf("break\n");
return 0;
}

126) int main()


{
int i;
char str[]="Borntowin";
printf("break\n");
for(i=0;str[i]!='\0';i++)
{
return;
break;
putchar(str[i]);
putchar('*');
}

}
127) int main()
{
int i;
char str[]="Borntowin";
for(i=0;str[i]!='\0';i++)
{
continue;
putchar(str[i]);
putchar('*');
}
printf("break");

128) int main()


{
int i;
char str[]="Borntowin";
printf("exit");
for(i=0;str[i]!='\0';i++)
{
exit(0);
putchar(str[i]);
putchar('*');
}

129) int main()


{
int i;
char str[]="Borntowin";
printf("exit");
for(i=0;str[i]!='\0';++i++)
{
exit(0);
putchar(str[i]);
putchar('*');
}

}
130) int main()
{
int i;
char str[]="Borntowin";
printf("exit");
while(1)
{
exit(0);
putchar(str[i]);
putchar('*');
}

131) int main()


{
int i;
char str[]="Borntowin";
while(!1)
{
printf("exit");
exit(0);
putchar(str[i]);
putchar('*');
}
printf("*");

132) int main()


{
int i;
char str[]="Borntowin";
printf("*");
return;
while(!!1)
{
printf("exit");
putchar(str[i]);
putchar('*');
}

}
133) int main()
{
int i;
char str[]="Borntowin";
if(str)
{
putchar(str[i]);
putchar('*');
}

134) int main()


{
int i=0;
char str[]="Borntowin";
if(str)
{
putchar(str[i]);
putchar('*');
}

135) int main()


{
int i=0;
char str[]="Borntowin";
while(str[i])
{
putchar(str[i++]);
i=0;
}

136) int main()


{
int i=0;
char str[]="Borntowin";
while(str[i])
{
putchar(str[i++]);
i++;
}

}
137) int main()
{
int i=0;
char str[]="Borntowin";
while(str[i])
{
putchar(str[++i]);
++i;
}

138) int main()


{
int i=0;
char str[]="Borntowin";
do
{
putchar("%c",k);
++i;
}while(str[i]);

139) int main()


{
int i=0,k='a';
char str[]="Borntowin";
do
{
putchar('k');
++i;
}while(str[++i]);

140) int main()


{
int i=0,k='a';
char str[]="Borntowin";
do
{
putchar('k');
break;
++i;
}while(str[++i]);

}
141) int main()
{
int i=0,k='a';
char str[]="Borntowin";
do
{
putchar('k');
break;
++i;
}while(i&&k);

142) int main()


{
int i=0,k='a';
char str[]="Borntowin";
do
{
putchar('k');
++i;
}while(i&&k!=0);

143) int main()


{
int i=0,k='k';
char str[]="ashoke";
do
{
putchar('e');
putchar('v');
}while(str[i++]=='e');

144) int main()


{
int i=0,k='l';
char str[]="vectorindia";
do
{
printf("unconditional");
}while(0);

}
145) int main()
{
char str[]="res=%d";
int a='7';
int b='8';
str[11]='c';
printf(str,b);
return 0;
}

146) int main()


{
char str[]="res=%d";
int a='7';
int b='8';
str[11]='c';
printf(str,b*a);
return 0;
}

147) int main()


{
char str[]="res=%d";
int a='7';
int b='8';
str[11]='c';
printf(str,b%a);
return 0;
}

148) int main()


{
char str[]="res=%d";
int a='7';
int b='8';
str[11]='c';
printf(str,b/a);
return 0;
}

149) int main()


{
char str[]="res=%d";
int a='7';
int b='8';
str[11]='c';
printf(str,++b,++a);
return 0;
}
150) int main()
{
char str[]="res=%d";
int a='7';
int b='8';
str[11]='c';
if(0);
printf(str,++b,++a);
return 0;
}

151) int main()


{
printf(1+"%d\n", strlen("ashok_vector"));
return 0;
}

152) int main()


{
char str[10]="vectorindia";
if(str[11])
printf("%u\n"+01, strlen("ashokleyland"));
return 0;
}

153) int main()


{
char str[10]="vectorindia";
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
printf("%c\n",abcd);
return 0;
}

154) int main()


{
char str[10]="vectorindia";
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
break;
printf("%c\n",abcd);
return 0;
}
155) int main()
{
char str[10];
printf("char str[10]=","vectorindia");
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
return;
printf("%c\n","abcd");
return 0;
}

156) int main()


{
char str[10];
abc:
printf("char str[10]=","vectorindia");
return;
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
goto abc;
printf("%c\n","abcd");
}

157) int main()


{
char str[10];
abc:
printf("char str[10]=","vectorindia");
return;
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
goto abc;
printf("%c\n","abcd");
}

158) int main()


{
char str[10];
abc:
printf("vector","char str[]");
exit(0);
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
goto abc;
printf("%c\n","abcd");
}
159) int main()
{
char str[10];
while(1);
abc:
printf("vector","char str[]");
exit(0);
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
goto abc;
printf("%c\n","abcd");
}

160) int main()


{
char str[10];
while(1)
{
abc:
printf("vector","char str[]");
exit(0);
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
goto abc;
printf("%c\n","abcd");
}
}

161) int main()


{
char str[10];
do
{
abc:
printf("india","char str[]");
exit(0);
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
goto abc;
printf("%c\n","abcd");
}while(1);
}
162) int main()
{
char str[10];
do
{
abc:
printf("chennai\n","char str[]");
exit(0);
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
goto abc;
printf("%c\n","abcd");
}while(!1);
}

163) int main()


{
char str[10];
do
{
abc:
printf("chennai\n","char str[]");
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
goto abc;
printf("%c\n","abcd");
}while(!1||1);
}

164) int main()


{
char str[10];
do
{
goto abc;
printf("chennai\n","char str[]");
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
abc:
printf("%s\n","s");
}while(!1||1&&0);
}
165) int main()
{
char str[10];
do
{
goto abc;
printf("chennai\n","char str[]");
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
}while(!1||1&&0);
abc:
printf("%s\n","success");
}

166) int main()


{
char str[10];
do
{
printf("hi");
goto abc;
return;
printf("chennai\n","char str[]");
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
}while(!1||1&&0);
abc:
printf("%s\n","success");
}

167) int main()


{
char str[10];
do
{
printf("hi");
return;
goto abc;
return;
printf("chennai\n","char str[]");
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
}while(!1||1&&0);
abc:
printf("%s\n","success");
}
168) int main()
{
char str[10];
for(;;)
{
printf("hi");
return;
goto abc;
return;
printf("chennai\n","char str[]");
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
}while(!1||1&&0);
abc:
printf("%s\n","success");
}

169) int main()


{
char str[10];
for(;;)
{
goto abc;
return;
printf("chennai\n","char str[]");
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
}while(!1||1&&0);
abc:
printf("%s\n","return");
}

170) int main()


{
char str[10],i=0;
for(;str[i];)
{
abc:
goto abc;
return;
printf("chennai\n","char str[]");
if(!str[11])
printf("%u\n"+01, strlen("ashokleyland"));
}while(!1||1&&0);
printf("%s\n","return");
}
171) int main()
{
char str[10],i=0;
for(;str[i];);
{
printf("chennai\n","char str[]");
if(!str[11])
printf("%s\n", "ashok");
break;
}while(0);
printf("%s\n","exit");
}

172) int main()


{
char str[10],i=0;
for(;str[i];);
{
printf("chennai\n","char str[]");
if(!str[11])
printf("%s\n", "ashok");
break;
}while(0);
printf("%s\n","exit");
}

173) int main()


{
char str[10],i=0;
for(;str[];);
{
printf("chennai\n","char str[]");
if(!str[11])
printf("%s\n", "ashok");
break;
}while("break");
printf("%s\n","exit");
}

174) int main()


{
else if(1)
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
175) int main()
{
if(1>1){
printf("1");}
else if(1==1){
printf("2");}
else{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
}

176) int main()


{
if(1>=1){
printf("1");}
else if(1==1){
printf("2");}
else{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
}

177) int main()


{
if(1){
printf("1 ");}
if(1==1){
printf("2");}
else{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
}
178) int main()
{
while();
if(1){
printf("1 ");}
if(1==1){
printf("2");}
else{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
}

179) int main()


{
while(1);
if(1){
printf("1 ");}
if(1==1){
printf("2");}
else{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
}

180) int main()


{
while(1)
{
if(1){
printf("1 ");}
if(1==1){
printf("2");}
else{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
return;
}
}
181) int main()
{
while(printf("s"))
if(1)
{
printf("1 ");
printf("bye");
if(1==1){
printf("2");}
else{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
}
}

182) int main()


{
while(printf("s"));
if(1)
{
printf("1 ");
printf("bye");
if(1==1){
printf("2");}
else{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
}
}

183) int main() {


while(printf("s")&&0);
if(1)
{
printf("1 ");
printf("bye");
if(1==1){
printf("2");}
else{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
}
}
184) int main()
{
while(printf("s")&&0);
return;
if(1)
{
printf("1 ");
printf("bye");
if(1==1){
printf("2");}
else{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
}
}

185) int main()


{
while(printf("%d",(printf("s"))))
return;
if(1)
{
printf("1 ");
printf("bye");
if(1==1){
printf("2");}
else{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
}
}

186) int main()


{
if(printf("%s","while(1)"))
return 0;
while(printf("%d",(printf("s"))))

return;
}
187) int main()
{
while(1)
if(printf("%s","while(1)"));
return 0;
while(printf("%d",(printf("s"))))

return;
}

188) int main()


{
while(1)
{
while(!1);
if(printf("%s","while(!1)"));
return 0;
while(printf("%d",(printf("s"))))

return;
}
}

189) int main()


{
while(!1)
{
while(!1);
if(printf("%s","while(!1)"));
return 0;
while(printf("%d",(printf("s"))))

return;
}
printf("while(!1)");
}

190) int main() {


while(printf("while(!1)"));
{
while(!1);
if(printf("%s","while(!1)"));
return 0;
while(printf("%d",(printf("s"))))

return;
}
printf("while(!1)");
}
191) main()
{
printf("hi");
while(main())
{
while(printf("while(!1)"));
{
while(!1);
if(printf("%s","while(!1)"));
return 0;
while(printf("%d",(printf("s"))))

return;
}
printf("while(!1)");
}
}

192) main()
{
printf("hi");
break;
while(main())
{
while(printf("while(!1)"));
{
while(!1);
if(printf("%s","while(!1)"));
return 0;
while(printf("%d",(printf("s"))))

return;
}
}
printf("while(!1)");
}
193) main()
{
switch(0)
{
printf("hi");
case 0:while(printf("while(!1)"));
break;
{
while(!1);
if(printf("%s","while(!1)"));
return 0;
while(printf("%d",(printf("s"))))

return;
}
}
}

194) main()
{
switch(0)
{
case 0:while(printf("ashok"))
return;
{
while(!1);
if(printf("%s","while(!1)"));
return 0;
while(printf("%d",(printf("s"))))

return;
}
}
}
195) main()
{
switch(0)
{
default:printf("vector");break;
case 01:while(printf("ashok"))
return;
{
while(!1);
if(printf("%s","while(!1)"));
return 0;
while(printf("%d",(printf("s"))))

return;
}
}
}

196) main()
{
if("a")
{
break;
case 1:while(printf("ashok"))
return;
}
else
printf("Switch");
}

197) main()
{
if("a")
{
switch("a")
case 97:while(printf("ashok"))
return;
}
else
printf("Switch");
}
198) main()
{
if("a")
{
switch('a')
case 97:while(printf("ashok"))
return;
}
else
printf("Switch");
}

199) main()
{
if("a")
{
switch('a'++)
case 97:while(printf("97"))
return;
}
else
printf("Switch");
}

200) main()
{
if("a")
{
switch(200)
case 20:while(printf("200"))
return;
}
if("a")
printf("Switch");
}
Answers:
---------

1)ashoklinux
2)A
3)5
4)vector
5)vector
6)vectorc
7)7
8)0
9)0
10)hhe!
11)i am the best
12)9,4,1,1
13)ashok
14)21
15)Garbage
16)segmentation fault
17)compile error
18)slaog ruoy wolloF
19)segmentation fault
20)1
21)Garbage,hai
22)22
23)o world,o world
24)Hello
25)ABC D
26)joejb
27)00 00 00 00 00
28)unequal
29)segmentation fault
30)hello, wo 9
31)13
32)helloworld,0
33)helloworld
34)Ashok=8
35)1,4,4
36)e
37)FOLLOW YOUR PASSION
38)Hello World
39)A
40)orining
41)globe
42)globy
43)A| Ag Ag
44)AL Ag Ag
45)BRAZIL
46)GOAT
47)GOAT
48)ZILLA
49)segmentation fault
50)B*o*r*n*t*o*w*i*n*
51)value is = 7
52)FALSE
53)HelloFriends
54)haihelloaihello
55)hai,ai,i
56)compile error
57)infinite
58)7
59)hai
60)Garbage
61)%
62)segmentation fault
63)compile error
64)ff
65)ff
66)welcome
67)vectorf
68)vector
69)vector
70)segmentation fault
71)d
72)tor
73)dvector
74)dvector
75)f
76)u
77)u
78)%%
79)compile error
80)segmentation fault
81)vectorccindia
82)vector\d\dindia
83)vector\r\india
84)vectorindia
85)indiar
86)indiaector
87)sindiavector
88)exit
89)exit
90)exit
91)compile error
92)vector
93)vecto
94)Garbage
95)segmentation fault
96)v
97)w
98)v
99)compile error
100)Garbage
101)n1=12,n2=10
102)ver ver ver e e e
103)Happy
104)20
105)9
106)string
107)11,if u win
108)104,h
109)indiavector
110)vectorindia
111)compile error
112)Clo
113)skl
114) sk
115)sk
116)compile error
117)e
118)ashok,star
119)Ida
120)C For
121)De
122)segmentation fault
123)compile error
124)lo
125)break
126)break
127)break
128)exit
129)compile error
130)exit
131)*
132)*
133)segmentation fault
134)B*
135)infinite
136)Brtwn
137)onoi
138)compile error
139)kkkkk
140)k
141)k
142)infinite
143)ev
144)unconditional
145)res=56
146)3080
147)1
148)1
149)res=57
150)res=57
151)d
152)u
153)compile error
154)compile error
155)char str[10]=
156)infinite
157)char str[10]=
158)vector
159)infinite
160)vector
161)india
162)chennai
163)infinite
164)s
165)success
166)hisuccess
167)hi
168)hi
169)return
170)infinite
171)chennai,exit
172)chennai,return
173)compile error
174)compile error
175)2
176)1
177)1,2
178)compile error
179)infinite
180)1,2
181)infinite
182)infinite
183)s1,bye2
184)s
185)s,1
186)while(1)
187)infinite
188)while(!1)
189)while(!1)
190)infinite
191)infinite
192)compile error
193)infinite
194)ashok
195)vector
196)compile error
197)compile error
198)ashok
199)compile error
200)Switch

You might also like