C :: Incompatible Integer To Pointer Conversation
Nov 28, 2013
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(){
[Code]....
View 1 Replies
ADVERTISEMENT
Jul 13, 2014
/*
* symboltable.c
*/
#include "symboltable.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "include/utlist.h"
[Code] ....
View 2 Replies
View Related
Apr 17, 2014
I'm working on a program and everything works except for the follow function:
void swapHex(int x, int byte1, int byte2) {
unsigned char *b1, *b2, tmpc;
printf("%d in hex is %x
", x, x);
printf("swapping byte %d with byte %d
", byte1, byte2);
[Code] ....
I get the following errors when compiling:
In function "swapHex":
warning: assignment from incompatible pointer type
warning: assignment from incompatible pointer type
View 2 Replies
View Related
Apr 8, 2012
Below is my code snippet.I'm getting "Error:initialization from incompatible pointer type" error on line 'int *q = status;'.
Obviously, I'm missing something but has no clue...:(
void findwalls(int *p,int y,int x){
int status[y_count][x_count][4];
int *q = status;
for(int i = 0;i < (y_count * x_count * 4);i++)
*(q + i) = *(p + i);
View 1 Replies
View Related
Nov 3, 2014
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).
View 4 Replies
View Related
May 19, 2014
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:
#ifndef SLIST_H
#define SLIST_H
#include <stdlib.h>
typedef struct {
void *data;
slist_elem *next;
[code]....
View 2 Replies
View Related
Jun 4, 2013
Code:
#include <stdio.h>
#include <stdlib.h>
int size_b_row1;
int size_b_col1;
[Code].....
View 2 Replies
View Related
Jun 4, 2013
#include <stdio.h>
#include <stdlib.h>
int size_b_row1;
int size_b_col1;
int main(void) {
double C[4][4] = {{1,3,5,2},{7,6,2,2},{1,2,7,3},{2,3,5,3}};
double TC[4][4];
transpose(C, TC);
[Code] ......
View 2 Replies
View Related
Mar 22, 2014
I have this code:
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
[code]....
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.
View 6 Replies
View Related
Mar 18, 2013
The warning: :63:7: warning: passing argument 1 of fputc makes integer from pointer without a cast [enabled by default]
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
[Code]....
View 2 Replies
View Related
Dec 15, 2013
Code:
#include <stdio.h>
#include <stdlib.h>
#define CLASS 4
#define STUDENT 11
#define GRADE 5
[Code] ....
Giving me that error on 75:10
avesub+=grade[k];
and 90:17
donkeypunch+=grade[j][k];
not sure exactly why
View 8 Replies
View Related
Aug 5, 2014
I have written this program
Code:
#include <stdio.h>
#include <string.h>
int main(void) {
struct point {
[Code] ....
error: request for member is not a structure or union
printf("%d
,%d
",p1->i,p1->j);
I was just trying to typecast a integer pointer to structure pointer, but throws error as shown.
View 5 Replies
View Related
Apr 21, 2013
I am trying to make a program that prints out an 8 by 8 board with 1 queen on each row.
For example, if the user enters: 0,3,4,0,0,7,6,7
the program should create following board and print:
Q.......
...Q....
....Q...
Q.......
Q.......
.......Q
......Q.
.......Q
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
View 7 Replies
View Related
May 4, 2014
template <class ST>
bool OrderedSet<ST>::IsIn (const ST & value) const {
for (LNode * np = first; np != NULL; np = np -> next)
if (np -> next == value)
return true;
return false;
}
View 1 Replies
View Related
Jul 27, 2013
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
// multiplication.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "crypto.h"
#define PROGNAME "multiplication"
void usage();
int isnumaber(char* str);
[code]....
View 2 Replies
View Related
Mar 29, 2012
In the code below:
void test(int * i) {
i = new int;
*i = 10;
cout << "i: " << *i << endl;
[Code] ....
The outuput is:
i: 10
t: (some memory position).
If I really want to allocate an integer variable to t, i need to modify the void test(int * i) procedure to void test(int *& i).
View 2 Replies
View Related
Jun 3, 2013
I have an integer pointer and i want its address without allocating memory,
main() {
int *a;
cout<<a;
}
This is giving 00000000 and its but obvious. Now if i use address of a (&a) along with *a,
main() {
int *a;
cout<<a;
cout<<&a;
}
'cout<<a' gives me a constant address but 'cout<<&a' gives me different address.
what is the reason behind & and why behaviour of 'cout<<a' changes when using with &.
View 8 Replies
View Related
Jan 23, 2014
int hash = 0;
char *strings[100];
if((int)strings[i] != 0)
if((int) strings[hash] != 0)
while((int) strings[hash] != 0)
if((int)strings[hash] != 0)
if((int)strings[hash] != 0)
View 12 Replies
View Related
Sep 15, 2013
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
View 2 Replies
View Related
Mar 6, 2015
Code:
#include<stdio.h>
print_int_ptr(int *a){
printf(" a %i
" ,a);
printf(" &a %i
" ,&a);
[Code] .....
I get that warning : passing arg 1 of `print_int_ptr' makes pointer from integer without a cast|
View 3 Replies
View Related
Jan 18, 2015
Code:
#include <stdio.h>
int main(){
int a=15 ;
int b =20 ;
strcmp((a, "20") == 0) {
printf("Correct!");
[Code] .....
passing arg 1 of `strcmp' makes pointer from integer without a cast
View 11 Replies
View Related
Mar 26, 2014
I am having some errors with pointers and passing arguments.
Code:
#include <stdlib.h>
#include <stdio.h>
#define MAX_FILE_LENGTH 20
typedef struct node_{
int value;
struct node_* next;
[Code]....
View 3 Replies
View Related
Sep 21, 2013
I have a function that I want to exit gracefully when an "error" occurs in an input file. My function declaration is:
Code: BSTnode *buildTree(FILE *fp)
The few lines that are causing the problems are:
Code: if(regcomp(®ex, to_find, REG_EXTENDED | REG_NEWLINE) != 0) {
fprintf(stderr, "Failed to compile regex '%s'
", to_find);
return EXIT_FAILURE;
}
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.
View 9 Replies
View Related
Jul 4, 2013
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:
STACK_LINKAGE MEMHANDLE memFileAlloc(
UINT32 dwSize,
const char* pszFileName,
int iLine) {
void* pvChunk;
#if MEMORY_STATS
[code]...
I think the offending line is:
pvChunk = ClientMemAlloc(dwSize + sizeof(UINT32), NULL)
because that's what the log file tells me.
The system is a 16 core HP DL580 G4 with 8g RAM, RAID 0, Mandrivalinux 11.0 and the display is a Matrox Parhelia 256PCIx.
View 11 Replies
View Related
May 5, 2014
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:
This is my Node struct:
#ifndef NODE_H
#define NODE_H
#include <iostream>
template <typename T>
struct Node {
friend std::ostream &operator <<(std::ostream &os, const Node<T> &node) {
[Code] ....
The following is my set function:
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?
View 7 Replies
View Related
Oct 14, 2013
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
double temp, result;
char type;
[Code] .....
View 2 Replies
View Related