Just trying to compile some code with tcc:

#include<stdio.h>

main ()

{

int x = 10;
int *p;
p = &x;
x = 40;
printf(“%d %d %d %d”,x,&x,p,&p);

}

Trying to learn about pointers and memory addresses and I took the code right out of the book, any help?

Recommended Answers

All 3 Replies

Don't use %d to print out pointers.

Other than that, try explaining what you expect the code to do, and then compare that with what the code does.

Don't use a word processor as a text editor. Fancy quotes are not double quotes.

[edit]And consider a book that is a little more current.

No problem, we use an open courseware model, so when I said book I should have said a .pdf lesson our professors wrote, but I'll try out your suggestions and see what I come up with, btw I used notepad++

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.