You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
845 B
39 lines
845 B
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main()
|
|
{
|
|
char vowels[] = { 'A', 'E', 'I', 'O', 'U' };
|
|
char* pvowels = vowels;
|
|
|
|
printf("Point the addresses\n");
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
printf("&vowels[%d]: %p, pvowels + %d: %p, vowels + %d: %p\n", i, &vowels[i], i, pvowels + i, i, vowels + i);
|
|
}
|
|
|
|
printf("\nPoint the values\n");
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
printf("vowels[%d]: %c, *(pvowels + %d): %c, *(vowels + %d): %c\n", i, vowels[i], i, *(pvowels + i), i, *(vowels + i));
|
|
}
|
|
|
|
// Dynamic malloc for array
|
|
int n = 4;
|
|
char* parr = (char*)malloc(n * sizeof(char));
|
|
parr[0] = 'L';
|
|
parr[1] = 'o';
|
|
parr[2] = 'V';
|
|
parr[3] = 'e';
|
|
|
|
for (int i = 0; i < n; i++)
|
|
{
|
|
printf("%c", parr[i]);
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
free(parr);
|
|
|
|
return 0;
|
|
} |