RicardasSim icon

str num

RicardasSim | PRO | 09/08/20 04:05:31 PM UTC (Edited) | 0 ⭐ | 1354 👁️ | Never ⏰ | []
C |

500 B

|

None

|

0 👍

/

0 👎

//-std=c99 -Wall -Wextra -Wpedantic -Wshadow
 
#include <stdio.h>
#include <stdlib.h>
 
#define LIMIT_NUM 32
 
#define STRINGIZER2(x) #x
#define STRINGIZER(x) STRINGIZER2(x) 
 
int main()
{
 
    unsigned int var = LIMIT_NUM;
 
    printf ( "%d\n", var );
 
 
    int arr[LIMIT_NUM] = {0};
    
    printf( "%ld\n", sizeof arr / sizeof *arr );
 
 
 
    char *str = "LIMIT: " STRINGIZER(LIMIT_NUM);
 
    printf ("%s\n",  str );
 
 
    return 0;
}
 
/*
output:
 
32
32
LIMIT: 32
 
*/
 

Comments