AD1

Wednesday 22 February 2017

find the output

what will be the output of the following code 


output will be 
8  8  8  4
size of a pointer to any data type is type independent , size of pointer depends on your machine address bus.
sizeof("clu")  here "clu" is treated as array of characters ={'c','l','u','\0'}
so sizeof("clu") is 4 bytes

Tuesday 14 February 2017

Saturday 11 February 2017

Number of words in a string

Write a C function words(string) that accepts a string as input parameter and returns the number of words in this string 
as example
words("my name is mohamed") will return 4


Friday 10 February 2017

What will be the output of the following program

the output is 
Egypt 
explanation 
string name is the base address of the string variable which is an array of characters

Sunday 5 February 2017

Even or Odd

Write a C program to check if any entered number is even or odd without the use of conditional statements (if,else)


No loops

Write a C program to print the numbers from 1 to 10 without using any looping statements (for/while/do while)
also do not write printf() 10 times


Thursday 2 February 2017

convert to uppercase

Write a function upper() that accepts a string and converts all its characters into uppercase characters 
as example upper("c programming")=C PROGRAMMING


reverse a string

Write a function reverse() that accepts a string and reverses it 
as example reverse("hello") would return "olleh"

string of numbers

write a function that accepts string of numbers and converts it to digits 
as example convert("123")=123



Remove all blank spaces in a string

Write a C program to remove all the blank spaces from a string.
as example if string is "hello world , C programming" then the output will be "helloworld,Cprogramming"