Sponsored Content
Top Forums Programming Help understanding pointer assignment in c Post 302362770 by broli on Saturday 17th of October 2009 01:17:51 PM
Old 10-17-2009
Help understanding pointer assignment in c

after some years of pause, im returning to c.

char *varname = "asd";
int *number = 4;

the above code is wrong, because its assigning a value to an unreserved space, or because its changing the address the pointer is pointing ?

thanks for the replys!!
 

10 More Discussions You Might Find Interesting

1. Programming

pointer

void main() { int a={1,2,3,4,5,6,7,8,9,10}; int *p=a; int *q=&a; cout<<q-p+1<<endl; } The output is 10, how? if we give cout<<q it will print the address, value won't print.... if we give cout<<p it will print the address, value won't print.... p has the base addr; q... (1 Reply)
Discussion started by: sarwan
1 Replies

2. Programming

far pointer

what is far pointer in C (1 Reply)
Discussion started by: useless79
1 Replies

3. What is on Your Mind?

New Assignment

All Sys Administrators, With due respect I would like to know what should be BEST Things to do when LEAVING one job , and what Precaution MUST be taken while taking over new JOB?? Please Discuss in detail the STEP to be taken for both the TIME ?? (3 Replies)
Discussion started by: vakharia Mahesh
3 Replies

4. Programming

pass a pointer-to-pointer, or return a pointer?

If one wants to get a start address of a array or a string or a block of memory via a function, there are at least two methods to achieve it: (1) one is to pass a pointer-to-pointer parameter, like: int my_malloc(int size, char **pmem) { *pmem=(char *)malloc(size); if(*pmem==NULL)... (11 Replies)
Discussion started by: aaronwong
11 Replies

5. Homework & Coursework Questions

Assignment Help

1. List commands to create the directory hierarchy $HOME/a/b/c in vi to replace all occurences of TMP with tmp in lines 1 through 10 in vi to replace first occurence of CPU_file with DISK_file at line 15 2. Explain with a very simple example, usage of "ls -a" 3. What do the... (2 Replies)
Discussion started by: jessesaini
2 Replies

6. Shell Programming and Scripting

Help Assignment !! :D

Q-1 Write a shell script in Unix that lists files from your current working directory · By modification time when called with lm · By access time when called with la. By default, the script should show the listing of all the files in the current directory. Q-2 Write a... (1 Reply)
Discussion started by: Vishank Parikh
1 Replies

7. Homework & Coursework Questions

Help Assignment !! :D

Q-1 Write a shell script in Unix that lists files from your current working directory · By modification time when called with lm · By access time when called with la. By default, the script should show the listing of all the files in the current directory. Q-2 Write a shell script which... (1 Reply)
Discussion started by: Vishank Parikh
1 Replies

8. Programming

Understanding C++ template partial specialization with pointer datatype arguments

When I compile the below code, I am getting error as template<typename T> T AddFun(T i, T j) { return i + j; } template<> T* AddFun<T*>(T* i, T* j) { return new T(*i + *j); } int main() { int n = AddFun<int>(10, 20); int i = 10, j = 20; int* p = AddFun<int*>(&i,... (1 Reply)
Discussion started by: royalibrahim
1 Replies

9. Homework & Coursework Questions

Understanding Getopts in an otherwise easy assignment

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: In the command line I will be given files or words which will be USER ID's or a file of USER ID's. I am to let... (4 Replies)
Discussion started by: ByronicX
4 Replies

10. UNIX for Dummies Questions & Answers

Need a little help with assignment

Hello all im currently working on this assignment and a little stump on how to check for an argument heres the instructions: Step 4: Modify your script so that if there is an argument called TestError you display the following error message with your usage statement. TestError found Example:... (1 Reply)
Discussion started by: bsn3971
1 Replies
observe(n)																observe(n)

__________________________________________________________________________________________________________________________________________________

NAME
observe - Runtime debugging output in TkCon SYNOPSIS
observe command cmdname ?maxlevel? observe cdelete cmdname observe cinfo cmdname observe variable varname operation ?args? observe vdelete varname operation observe vinfo varname _________________________________________________________________ DESCRIPTION
This command provides runtime debugging output for variables and commands without the need to edit your code. For variables, the underly- ing mechanism uses trace and dump var. For commands, it renames the observed procedure and uses a special wrapper procedure. WARNING: using this procedure after checkpointing state will result in major problems if you clean state because the renamed (true) commands will be lost. This procedure is experimental. Comments are encouraged. observe command cmdname ?maxlevel? This will create a wrapper command which prints out (using dump) the call stack to the console. maxlevel represents the maximum number of levels of the call stack which will be printed (defaults to 4). observe cdelete cmdname Removes the wrapper around an observed command. observe cinfo cmdname Prints out useless info. observe variable varname operation ?args? Currently a wrapper around trace that uses dump to print out the value of the named variable whenever the specified operation on that variable occurs (must be read, write or unset). observe vdelete varname operation Deletes the trace wrapper around the named variable. observe vinfo varname Prints out trace info about the named variable. SEE ALSO
dump(n), idebug(n), tkcon(1), tkcon(n), tkconrc(5) KEYWORDS
Tk, console, debug COPYRIGHT
Copyright (c) Jeffrey Hobbs <jeff at hobbs.org> TkCon 2.5 observe(n)
All times are GMT -4. The time now is 05:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy