468,513 Members | 962 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

how to assign static array to a pointer array

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
1 3771
Banfa
9,056 Expert Mod 8TB
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.

Similar topics

1 post views Thread by Dario de Judicibus | last post: by
1 post views Thread by Bryan Parkoff | last post: by
8 posts views Thread by Peter B. Steiger | last post: by
2 posts views Thread by Index | last post: by
11 posts views Thread by pemo | last post: by
14 posts views Thread by Jeroen | last post: by
7 posts views Thread by John Koleszar | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.