By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

how to assign static array to a pointer array

P: 1
hi ,
i need the group members help

I need to use pointer array to store list of static integers

eg.

uint16 *t_async = (uint16 *)malloc(35);

* t_async[] = {29,30,39}; // this statement throws error.


could anyone pls help.
jai
Sep 22 '06 #1
Share this Question
Share on Google+
1 Reply


Banfa
Expert Mod 5K+
P: 8,916
uint16 *t_async = (uint16 *)malloc(35);
You appear to have allocated memory for 17 /1/2 16 bit integers, is this may be a mistake?

* t_async[] = {29,30,39}; // this statement throws error.
You can not assign an array to an array in C/C++ you can only initialise an array and you never have an array to initialise.

You will have to

Expand|Select|Wrap|Line Numbers
  1.   t_async[0] = 29;
  2.   t_async[1] = 30;
  3.   t_async[2] = 39;
  4.  
Sep 22 '06 #2

Post your reply

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