R
rp
I am having problems with array of pointers. Could someone tell me
whats the problem with my program, shown below.
#include <stdio.h>
#include <string.h>
#define NUM_KEYWORDS 3
char *table[NUM_KEYWORDS] = { "abcdef",
"ghijkl",
"mnopqr"
};
void capitalize(char *str) {
int size = strlen(str);
int i=0;
for(i=0; i < size; i++) {
if((str >= 0x61) && (str <= 0x7a))
str = str - 0x20;
}
}
int main() {
int i;
for(i=0;i<NUM_KEYWORDS; i++) {
capitalize(table);
printf("Capitalized keywords %s\n", table);
}
return 1;
}
whats the problem with my program, shown below.
#include <stdio.h>
#include <string.h>
#define NUM_KEYWORDS 3
char *table[NUM_KEYWORDS] = { "abcdef",
"ghijkl",
"mnopqr"
};
void capitalize(char *str) {
int size = strlen(str);
int i=0;
for(i=0; i < size; i++) {
if((str >= 0x61) && (str <= 0x7a))
str = str - 0x20;
}
}
int main() {
int i;
for(i=0;i<NUM_KEYWORDS; i++) {
capitalize(table);
printf("Capitalized keywords %s\n", table);
}
return 1;
}