471,873 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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


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

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

could anyone pls help.
Sep 22 '06 #1
1 4000
9,065 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;
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 YellowAndGreen | last post: by

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.