Short int in C Programming

Learn via video course
FREE
View all courses
C++ Course: Learn the Essentials
C++ Course: Learn the Essentials
by Prateek Narang
1000
5
Start Learning
C++ Course: Learn the Essentials
C++ Course: Learn the Essentials
by Prateek Narang
1000
5
Start Learning
Topics Covered

Short int in C is a data type in the C Programming language. Short int in C occupies 2 bytes of memory. Number Range of short int is −32,767 to +32,767.

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

Size of Different int Data Types

In terms of occupying memory the size of int, short int, will vary. To be more specific, int occupies four bytes of memory while short int occupies only two bytes of memory.

An interesting thing to learn is that in C programming language, short int or short reflects the same meaning.

In C programming language, sizeof() operator can be used to find the size of data type

Let us explore the size of int, short int in C by executing a C program:

Output

As, short and short int both are the same, from the output of the above program we can clearly say that size of short and short int in C is also the same ( two bytes). Also, from the output section do observe that the int data type occupies 4 bytes of memory.

For Integer, we have 8 possible types:

  • int, unsigned int
  • short, unsigned short
  • long, unsigned long
  • long long, unsigned long long

Now, Let us discuss them in detail

int, Unsigned int

Size of int data type is 4 bytes. Size of unsigned int data type is 4 bytes. The size of int may vary according to the compiler, a 32-bit compiler will give int size as 2 bytes whereas the 64-bit compiler will give 4 bytes. Let us confirm the size of int, unsigned int data type by executing a small C program:

Output

Also, note that the range of int is -2147483648 to 2147483647 while the range on unsigned int is 0 to 4294967295

Free Courses by top Scaler instructors
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science

short, Unsigned short

Size of short data type is 2 bytes. Size of unsigned short data type is 2 bytes.

Let us execute a C program to demonstrate the size of short, unsigned short data type:

Output

Also, note that the range of short is -32768 to 32767 while the range on unsigned short is 0 to 65535.

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

long, unsigned long

Size of long data type is 8 bytes. Size of unsigned long data type is 8 bytes.

Let us execute a C program to demonstrate the size of long, unsigned long data type:

Output

Also, note that the range of long is -9223372036854775808 to 9223372036854775807 while the range of unsigned long is 0 to 18446744073709551615.

long long, unsigned long long

Size of long long data type is 8 bytes. Size of unsigned long long data type is 8 bytes.

Let us execute a C program to demonstrate the size of long long, unsigned long long data type:

Output

Also, note that the range of long long -9223372036854775808 to 9223372036854775807 is while the range of unsigned long long is 0 to 18446744073709551615.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Learn More

By this point, we got a good idea about short in C. To explore and to be more knowledgable about short int and data types in C do refer our article.

Conclusion

  • Short int or short portrays the same meaning.
  • In C programming language, short is the integer data type that occupies two bytes of memory.
  • The range of short int type is -32768 to 32767.