473,394 Members | 1,740 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,394 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

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 4148
Banfa
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;
  4.  
Sep 22 '06 #2

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

Similar topics

1
by: Dario de Judicibus | last post by:
I wish to define in my application a static constant array of static constand structure. I am not sure which is the right declatarion and initialization. For example, if structure is ...
1
by: Bryan Parkoff | last post by:
I know how to write "Pointer to Function" inside struct or class without using static, but I have decided to add static to all functions inside struct or class because I want member functions to be...
3
by: Makiyo | last post by:
how do u do something like this char x; x = "hello"; I got an error, but is there a way I can do it without using pointer? thx ; )
8
by: Peter B. Steiger | last post by:
The latest project in my ongoing quest to evolve my brain from Pascal to C is a simple word game that involves stringing together random lists of words. In the Pascal version the whole array was...
2
by: Index | last post by:
Hi, I have declared a static array in main and want to use it in a function in another file.The function where this array will be used is called from main itself.Can you suggest me a way to do...
11
by: pemo | last post by:
Could someone tell me if I have this right please? Given this definition: void someFunc(char a){} The 'static' says that a will not be a NULL pointer, and will always ** 10 elements. ...
14
by: Jeroen | last post by:
Hi all, I've got a question about writing a library. Let me characterize that library by the following: * there is a class A which is available to the user * there is a class B that is used...
17
by: copx | last post by:
I don't know what to think of the following.. (from the dietlibc FAQ) Q: I see lots of uninitialized variables, like "static int foo;". What gives? A: "static" global variables are initialized...
7
by: John Koleszar | last post by:
Hi all, I'm porting some code that provides compile-time assertions from one compiler to another and ran across what I believe to be compliant code that won't compile using the new compiler. Not...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.