|
hello i want reserve string in c just using(string.h) such strcat and strcpy and strcmp libirty
without (for or poniter)
how???
|
|
|
|
|
Hi, I thing when you say poniter its pointer.
All strings and arrays in C are pointers so you cant change it.
However if you want to create a string otherwise you can use malloc, with malloc you can create one array of any size, you can see it here
But you have other way to do it, if you want to read a string for keyboard you may be need to use strdup() from string.h
|
|
|
|
|
hay
i want reserve without chang index for array
exmple with change index:
char array[20];
int i,j;
gets(array);
j=strlen(array);
for(i=j-1;i>=0;i--)
{printf("%c",array[i])
}
i want use (strncat & strncpy with for)...for Reverse string
but i don't know how i can do this
::
ex ::
char array[20];
int i,j;
j=strlen(array);
for(*******)
{
strncat(****) or strcat(***)
or strncpy(***) or strcpy;
}
and in the end i want Reverse string
|
|
|
|
|
|
. Create a List [ Create a list that will be empty at the creation time. Make void create( void ) function to achieve this task. ]
2. Determine whether the list is empty. [ Make bool empty( void ) function that shows whether the list is empty or not.]
3. Insert a Value
at the start of the list [ Make void addatstart( int ) function to insert value at the start of the list.]
at the given location [ Make void addatspecific( int, int ) function to insert value at the specific location in the list.]
at the end of the list [ Make void addatend( int ) function to insert value at the end of the list.]
4. Delete
at the start of the list [ Make void deleteatstart( void ) function to delete value from the start of the list.]
at the given location [ Make void deleteatspeific(void) function to delete value at the specific location of the list.]
at the end of the list [ Make void deleteatend(void) function to delete value at the end of the list.]
5. Size of the List [ Make int size(void) function that will return the size of the list.]
6. Search value from the list. [ Make void search( int ) function that will search the given value in list.]
7. Swapping two values of the list. [ Make void swap( int first_location, int second_location ) function that will swap the values at the given location from the list.]
8. Display the list [ Make void search(void) function that will display the list values.]
|
|
|
|
|
Sorry, but no one is going to do your homework for you. Make an effort to solve the problem for yourself and people will try to help you when you get stuck, but you are expected to do most of the work. After all, an assignment is designed to test how much you have learned, not how much we know.
|
|
|
|
|
Richard MacCutchan wrote: After all, an assignment is designed to test how much you have learned, not how much we know. Truer words have never been spoken typed.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
|
Hi,
I have a MFC application. I work with Visual Studio 2010 and C++.
I have changed the caption of a menu item in the IDE.
When I run the application, the caption is not changed.
Do I have to changed the menu in a particular file?
Thanks,
Claude
|
|
|
|
|
Try rebuilding the whole project. Right-click the project in Solution Explorer, and choose "Rebuild".
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Gagnon Claude wrote: I have changed the caption of a menu item in the IDE. Where exactly did you change it, and have you rebuilt the project?
|
|
|
|
|
Hi,
I have a project generated by Visual Studio 2010 with a tree view .
They are two tabbed pane.
I want to change the tabbed pane text and the title of the pane over.
I have tried with IDS_CLASS_VIEW, but it changes only the tooltips over the tabbed pane.
How can I change the tabbed pane and title text?
Thanks,
Claude
|
|
|
|
|
|
i want to build a program that can compile simple codes like printf,scanf,etc. can iget any suggestions ?
plus, can i add a third party compiler in a my program ?
|
|
|
|
|
Compile them into what? The compiler will turn source into object code, but that object still needs to be linked to the system libraries in order to run. Maybe you need to provide more information about exactly what your application is supposed to do.
|
|
|
|
|
well, the application should have a compiler or compiling system for simple codes and i want to know if i can add a compling system to any application. If there is a way , please reply ,
Thanks for the reply anyway.
|
|
|
|
|
Member 11227854 wrote: i want to know if i can add a compling system to any application. Short answer: No.
Longer answer: It is possible to compile a complete module by calling out to a compiler from an application via ShellExecute or similar. But just compiling simple statements in isolation would entail a very large amount of work.
|
|
|
|
|
The simplest way is feeding an actual compiler with the code. You may use system[^], or ShellExectute[^], CreateProcess[^] for running the actual compiler.
You can add a third party compiler to your application if the compiler's license allows it (I suppose you'll find a C compiler with such a liberal license).
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
can you provide some info on adding compiler in my system, it would be great. Thanks for the reply.Your help was appreciated.
|
|
|
|
|
Member 11227854 wrote: can you provide some info on adding compiler in my system
...you just have to install it...
|
|
|
|
|
sorry i couldnt understand what you are saying. The thing is that i am building a application that contains a compiler and i want to know how to add it. I am still a newbie so please elaborate .
|
|
|
|
|
The compiler will be an external process (see above message from CPallini)
for example, on windows you could do something like :
If you edit the file in your own application, then you will need to save it on disk before compiling it.
system("cl.exe yourfile.cpp");
After that works (calling the compiler), you can try catching the compiler result (in case of errors and warnings) and display that to the user.
This will work for simple 1 file program (with a valid main ), if you want to compile and link multiple files (like visual studio do), then you will have to do a lot more work (using some sort of "make file").
Good luck.
Max.
I'd rather be phishing!
|
|
|
|
|
Member 11227854 wrote: ...i am building a application that contains a compiler and i want to know how to add it. I am still a newbie... Those two things typically do not go together well, at least not without a lot of prior knowledge. How about a less ambitious project (or two) to get you acquainted with C/C++/MFC development?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
<pre lang="text">
I am trying to build a two dimmensional array - accessing LCD of 10 rows and 20 columns and be able to pass the pointer(s) to a function.
The function / method is declared in class and so is the pointer:
boolean DisplayImage(int **Display);
int **Display;
</pre>
And the function:
<pre lang="c++">
boolean CImage::DisplayImage(int **Display)
{
#ifdef DEBUG
TRACE("CImage::DisplayImage ** ", 1);
#endif
int i, j, iRow, iCol;
iRow = 10;
iCol = 20;
int iCount = 0;
for ( i = 0; i < iRow; i++) {
for (j = 0; j < iCol; j++) {
lcd_i2c.clear();
lcd_i2c.print("location ");
lcd_i2c.setCursor(0, 1);
lcd_i2c.print("row i ");
lcd_i2c.print(i );
lcd_i2c.print(" col j ");
lcd_i2c.print(j );
lcd_i2c.setCursor(0, 2);
lcd_i2c.print("Display ");
**Display = iCount++; // set test value - works
lcd_i2c.print(**Display); // display is OK
// lcd_i2c.setCursor(0, 3);
// lcd_i2c.print("mask center ");
// lcd_i2c.print(**image );
**Display++;
delay(500);
}
}
return true;
}
</pre>
Here is how I initialize the array
<pre lang="c++">
CImage::CImage (void)
{
// initialize array using pointers
// int **Display;
Display = new int *[10]; // display rows
for (int i = 0; i < 20; i++)
Display[i] = new int[10]; // display columns
}
</pre>
Here are my questions:
1. I need some explanation about this syntax "Display = new int *[10]" - is the "Display " the variable name ?
2. I may have the rows / columns reversed because<b> I really do not understand how is the array initialized</b>.( <b><b></b>That is my main question</b> - I can take it from there ).
3. Unfortunatelly the example I got this from had 10 by 10 array so I am lost as far as what are the columns and what are the rows.
4. I use rows and columns because that is the underlying hardware and I understand it is irrelevant as far as multidimmensioal array goes.
5. Under present initialization I cannot get the LCD print pass first "row". The processor just stops ( Arduino Due). I would expect it to keep printing even if I runs out of valid pointer, but that is not the case. I sure would like to know why. ( It "runs" GCC compiler).
Thank you for your time and help. Appreciate it.
Cheers Vaclav
PS I do not have a real debugger and using the LCD as "trace / debug "
|
|
|
|