C Saved Program: fragrant-terrain

facebook share

Here's the online compiler accompanied with IDE at your service. This is a saved code by one of our users. Try it out or save your own from the IDE page and don't forget to leave a feedback. You can find that at the bottom of the page.


#include<stdio.h>
#include<string.h>

typedef struct slot {
    int value;
    char arr[10];
    char *cp;
    struct slot *sp;
}slot;
int main() {
    slot a, b, *p, *q;
    a.sp = &b;
    p = &b;
    q = &a;
    p->sp = &a;
    p->cp = &(q->arr[5]);
    b.cp = &(b.arr[1]);
    p->value = b.cp - p->cp;
    q->value = 10;
    strcpy(b.arr, "hello"); 
    strcpy(a.arr, "qwrtyuipav");
    printf("%d %d %s", a.value, b.value, b.arr);
    if(*b.cp == 'l')   
        printf(" yes");
    else
        printf("No");
    *a.cp = 20;    
    return 0;
}
Execute

Output

Press the execute button or CTRL + enter to run code.

Inputs