473,395 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

incompatible types in assignment?

158 100+
I am getting a "error: incompatible types in assignment" error and cant figure out why? I am trying to set lastRow to row at the end of the code snippet.

Expand|Select|Wrap|Line Numbers
  1.     int row[height][3];
  2.     int lastRow[height][3];
  3.  
  4.     size_t rowIdx, idx = 0;
  5.     int cRow = startX;
  6.     for (idx = startX ; idx < height*width; idx += width)
  7.     {
  8.       cRow = (idx/width);
  9.  
  10.       row[cRow][0] = redImg.data[idx]; 
  11.       row[cRow][1] = greenImg.data[idx] ;    
  12.       row[cRow][2] = blueImg.data[idx]; 
  13.  
  14.     }
  15.  
  16.     lastRow = row;
  17.  
Aug 11 '09 #1
2 2725
Banfa
9,065 Expert Mod 8TB
C/C++ does not support arithmetic operations on arrays including copying.

If this is C then use memcpy.

If this is C++ you should be using vectors not arrays (which do support copying).
Aug 11 '09 #2
donbock
2,426 Expert 2GB
Another approach would be to have two generically named arrays plus two pointer-to-array variables called row and lastRow. Instead of copying the row array you could swap the pointer values.

However, working with a pointer to a two-dimensional array can be quite tricky. If you're interested in this approach you should first read Arrays Revealed.
Aug 11 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Brian Stubblefield | last post by:
Dear clc members, I am new to C and am posting several messages concerning a large C program that I am debugging. I am encountering a "incompatible types in assignment" warning for the...
2
by: Dennis Schulz | last post by:
Hi all, the following programm is supposed to check for login and password with inbuilt linux functions. in line 57 and 64 there are erorrs: incompatible types in asignment. whats wrong with...
10
by: gk245 | last post by:
I have something like this: #include <stdio.h> main () { struct line { char write; char read;
8
by: fei.liu | last post by:
I have the following source code. It seems wierd to me why gca's value cannot be reassigned. It's afterall a pointer and has a pointer value. I am aware that the standard says it's not allowed. But...
13
by: william | last post by:
code segment: long int * size; char entry; ............. size=&entry; ************************************* Gcc reported 'assignment of incompatible pointer type'.
1
by: pyo2004 | last post by:
Here's the definition of work_struct struct work_struct { unsigned long pending; struct list_head entry; void (*func)(void *); void *data; void *wq_data; struct timer_list timer; };
6
by: billiabon | last post by:
Hello,everybody! I need your help! My problem is this assignment char pnm; void enqueue(int pd,char pnm,int pnum,int ptm,struct queue *z) {struct node *p; p=(struct node...
4
by: pandaemonium | last post by:
I have two quick problems with the code I am writing: First, I define a struct of char arrays (strings) and then try accessing the same. I get an "incompatible types in assignment" error: struct...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.