top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between int and char in C?

+3 votes
448 views
What is the difference between int and char in C?
posted Feb 26, 2017 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Both are integer data type. Int can be short int, int or long int and size can be 2, 4, 4 or 2, 2, 4 or 2, 4, 8 bytes based on the compiler and machine where as char is always one byte. One more difference is by default char is unsigned and int is a signed if not specified explicitly.

answer Feb 27, 2017 by Salil Agrawal
Similar Questions
+1 vote

What type of conversion is not accepted in C and why?
a) char to int
b) float to char pointer
c) int to char
d) double to char

+4 votes

What will be the output of this code?

 void main(){
       int i=320;
       char *ptr=(char *)&i;
       printf("%d",*ptr); 
    }
...