I am getting error"incompatible integer to pointer conversation..." and don't know how to fix this. In my code, user inters line like this (3+3*(55-52)) I need to separate number from the line so I can do other operation.here is my code
Code:
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
int main(){
So for a project, my professor sent out two pages of code containing functions to read a text file (since we do not know how to write this on our own yet). I've got the code working on Orwell IDE and it gives me 2 warnings saying
"Passing argument 1 of 'readFromFile' from incompatible pointer type"
"Passing argument 2 of 'option2Print' makes integer from pointer without a cast"
The Orwell IDE seems to just bypass these warnings and compiles the code correctly. However, when I transferred my files over to my desktop using BloodShed (what the professor uses), instead of getting a warning I get an error and the code won't compile.
I assume it will not compile on his computer either since he uses the BloodShed IDE.
I don't know how to put the code directly into the text neatly, so a attached a .zip file with my code. The "storms.txt" file is also included. (the file that will be read).
I am trying to write a generic linked list in c, but for some reason i keep getting errors saying "incompatible pointer type. This is the code and erros:
What I want is basically to assign to the *p the pointer of the string so that i could do the following printf(" print string %s",*p); so i dont know how to do that.
I think I am doing it right but im getting a couple of errors that i cant fix ...
#include <iostream> using namespace std; int main(){ int x [8] [8], r, c; for(c = 0; c <= 8; c++){ cout << " Enter a number from 1 to 7 " << endl;
[Code] .....
these are the errors :
assignment15_meem.cpp: In function âint main()â: assignment15_meem.cpp:7: error: no match for âoperator>>â in âstd::cin >> x[c]â assignment15_meem.cpp:10: error: ISO C++ forbids comparison between pointer and integer
when i compile the following program i get a compiler warning, but i don't understand why. for me the code seems to be all right and does legitimate this warning. so here is the code
Create in the private section of the ServerGroup class a pointer to a dynamic integer array called servers.
#ifndef ServerGroup_h #define ServerGroup_h class ServerGroup { public: private: int *ptr = new int; // needs pointer to a dynamic integer array called servers }; #endif
I know that if I just use "return" by itself the warning goes away but fails to exit when the error occurs. I also believe this may not be the correct use of stderr. But I need the program to exit when an error has occurred.
The log file gives me: In function ‘memFileAlloc’ assignment makes pointer from integer without a cast..When compiling the drivers for the Matrox card in the DL580. The offending code is:
I'm trying to write a function called 'set' that sets the value of the i'th cell to val on my linkedList, and then returns the previous contents. I am stuck on it due to compiling errors:
template <typename T> T set(Node<T> *head, int i, const T &val) { for(int n = 0; n < i; n++) if(head == val) { val = i; } return val; } #endif
When I try to call it in the main() I get these errors:
node_utils.h: In function ‘T set(Node<T>*, int, const T&) [with T = int]’: node_demo.cpp:26:38: instantiated from here node_utils.h:161:2: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] node_utils.h:162:3: error: assignment of read-only reference ‘val’
So, I understand that I can't compare head & val on my if-statement -- But what do I do?