This week's book giveaway is in the Open Source forum.
We're giving away four copies of Programmers Guide to Apache Thrift and have Randy Abernethy on-line!
See this thread for details.
Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

problem adding a simple pointer.  RSS feed

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following simple code in C.

#include <stdio.h>
int main()
{
int x = 7;
printf("x is %d\n",x);
x = 14;
printf("x is %d\n", x);
int *aptr = &x;
}


As soon as I add the line       int *aptr = &x;     I get missing ';' before 'type' when I try to compile. Why would that happen? Everything looks fine and compiles fine except when I add that new line. What I am doing should work.
Iam using Visual Studio Professional 2012

thanks
 
Ranch Hand
Posts: 117
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jim

It compiles fine for me when I copy/paste your code into a file and compile using gcc in linux. Are you absolutely sure that what you've posted and what you're compiling are the same?

Cheeers
John
 
Jim Smithe
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes and the code is from the video found here talking about creating pointers.
https://www.youtube.com/watch?v=mw1qsMieK5c
Looks like that guy in youtube video uses something other than Visual studio to.
Its is a direct copy and paste from my project.
Unfortunatly I really need it to work in Visual Studio. All my work is in that
 
Marshal
Posts: 64471
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is a good tutorial
 
Saloon Keeper
Posts: 10206
216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What project type did you create in Visual Studio?
 
Jim Smithe
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I think I got it. I had to create a new project and just do it again. For some reason that worked even though they both look the same. I create a win32 console application.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!