Introduction To Programming

Why programs ? Programming is nothing but making the computers think the same way a human thinks. Programs are made for obtaining a specific solution which can even be solved by humans which when solved by us may consume time..

Saturday, February 20, 2010

Scanf inside printf

#include < stdio.h >
int main()
{
int a,b;
printf("%d",scanf("%d %d",&a,&b));
}


Output:


2


Logic:


To know what'll return by scanf function and printf function , read these post:

scanf returns
printf function returns

28

#include < stdio.h >
#include < string.h >
int main( )
{
char a[ ]="shark srini";
char *b;
int i;
b=&a[0];
for(i=0;i<4;i++)
{
printf("%c",*a);
b++;
}
}


Output:


s
s
s
s

s

Logic:


click here to get the logic.