I'm trying to learn C for a class next semester, and have a background in python. I would like to print multiple arguments, both strings and various datatype objects using printf(). My code is as follows:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
short int x = 1;
unsigned short int y = 2;
printf("Short int x: %", x);
printf("Unsigned short int y: %", y);
}
I am using Eclipse with a CDT plugin, no issues with binaries or anything.
I looked up the man page for printf() but was having some issues with the %. notation. Could someone elaborate on printf's capabilities.
Thank you.
printf("Short int x: %hd", x);andprintf("Unsigned short int y: %hu", y);