Error Invalid Type Of Argument Of Unary
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the error invalid type argument of unary in c company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
Error Invalid Type Argument Of Unary ‘*’ (have ‘double’)
Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million
Error Invalid Type Argument Of Unary ‘*’ (have ‘int’)
programmers, just like you, helping each other. Join them; it only takes a minute: Sign up error: invalid type argument of ‘unary *’ (have ‘int’) up vote 20 down vote favorite 7 I have a C
Error Invalid Type Argument Of Unary '*' (have 'int')
Program: #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about invalid type argument of unary ‘*’ (have ‘float’) Stack Overflow the company Business Learn more about hiring developers or posting ads invalid type argument of unary '*' (have 'float') with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow invalid type argument of unary '*' (have 'double') is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Pointers ABC. error: invalid type argument of unary ‘*’ (have ‘struct config’) up http://stackoverflow.com/questions/5455866/error-invalid-type-argument-of-unary-have-int vote 2 down vote favorite I have a basic problem. I should know enough about pointers by now. The way I see it configData is the first link in a linked list (of the type struct config) while procNames is a pointer to the first link in a linked list of the type struct config. So if I want to say that procNames is equal to configData then I need http://stackoverflow.com/questions/9559957/pointers-abc-error-invalid-type-argument-of-unary-have-struct-config to access the pointer that points to configData which is *configData. Anyhow I think I am missing something. Anyone sees the problem? Also, I get the next error: error: invalid type argument of unary ‘*’ (have ‘struct config’) struct config_line { char name[MAX_WORD]; int time; }; struct config { struct config_line *lines; int count; }; //global variable struct config configData; //local variable struct config *procNames; //the problem (done locally) procNames = *configData; c pointers struct linked-list share|improve this question edited Mar 4 '12 at 23:50 caf 155k14192324 asked Mar 4 '12 at 23:39 Paul Kar. 5102923 add a comment| 2 Answers 2 active oldest votes up vote 3 down vote accepted I think you want procNames = &configData; This sets the pointer procNames to the address of the structure configData. You can access the elements using either procNames->count procNames->lines[i].name // Pointer to the 1st char of the name in the i'th config_line structure or configData.count configData.lines[i].name Remember that, since lines is itself a pointer, you'll need to allocate memory for each config_line structure: struct config_line thisLine; // Declare a structure procNames->lines = &thisLine; // Point to it or // Declare a pointer to an array of structures, allocate memory for the structures struct config_line *linePtr = mal
Programming Boards C Programming Invalid type of unary '*' Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get http://cboard.cprogramming.com/c-programming/123366-invalid-type-unary-*.html a compiler | Fixes for common problems Thread: Invalid type of unary '*' Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded https://bytes.com/topic/c/answers/950228-invalid-type-argument-unary Mode 01-23-2010 #1 trishaxxcore View Profile View Forum Posts Registered User Join Date Jan 2010 Posts 3 Invalid type of unary '*' Good day! I'm having problems with my lab activity(which I can't find the invalid type solution), it's already graded but I have to finish it and to make it function. Is there something wrong with the way I reallocated space? Please help me find the solution for this. I have problems during compile time, it says: invalid type argument of unary '*' Code: int getInputs(int **ptr) { int x, w; int i=0; int y=0; int *pTemp; *ptr = malloc(sizeof(int)*10); do { print("enter number here:"); argument of unary scanf("%d", &x); if (i<10) { if(x>0) { *(*ptr + i) = x; i++; y++; } else if(x==0) { *(*ptr + i) = x; i++; } } else { w=i++; if(x>0) { pTemp = realloc(ptr, sizeof (int) * 10); *(*pTemp + w ) = x; // invalid type argument of unary '*' y++; w++; } else if(x==0) { *(*pTemp + w ) = x; // invalid type argument of unary '*' w++; } } }while(x>=0); return y; } PS. 01-23-2010 #2 Memloop View Profile View Forum Posts Registered User Join Date Mar 2009 Posts 399 Change it to: Code: *(pTemp + w ) 01-23-2010 #3 trishaxxcore View Profile View Forum Posts Registered User Join Date Jan 2010 Posts 3 Originally Posted by Memloop Change it to: Code: *(pTemp + w ) I already changed it that way. It now says [Linker Error]:Undefined reference to print. 1d returned 1 exit status. 01-23-2010 #4 Memloop View Profile View Forum Posts Registered User Join Date Mar 2009 Posts 399 There's no "print" function in standard C. Use puts or printf. 01-23-2010 #5 trishaxxcore View Profile View Forum Posts Registered User Join Date Jan 2010 Posts 3 Originally Posted by Memloop There's no "print" function in standard C. Use puts or p
question and get tips & solutions from a community of 418,513 IT Pros & Developers. It's quick & easy. invalid type argument of `unary *' P: 1 nsbcnjsbc What's wrong?here's the code Expand|Select|Wrap|Line Numbers #include