Nov 17, 2024
short a; or short int a;signed short a; or signed short int a;unsigned short a; or unsigned short int a;%d%u#include <stdion.h>
void main() {
short a = 10;
clrscr(); // Clear screen
printf("%d", a); // Print value
}
a with value 10 and prints it.#include <stdio.h>
#include <conio.h>
void main() {
short x = 32769; // Exceeds maximum for signed short
clrscr();
printf("%d", x); // Outputs a negative value due to cycling
}
#include <stdio.h>
#include <conio.h>
void main() {
unsigned short x = -4; // Exceeds range
clrscr();
printf("%u", x); // Outputs a large positive value
}
#include <stdio.h>
#include <conio.h>
void main() {
unsigned short x = 65538;
printf("%u", x); // Outputs a wrapped around value
printf("%d", x); // Same output, different interpretation based on format
}