pointers are support in C#? if yes then how to use it?
Answers were Sorted based on User's Feedback
Answer / supratim sengupta
pointers in C# are considered as unsafe code. We can use
pointers in the same way as we use in C++ or VC++ but we
need to build it with a /unsafe option
| Is This Answer Correct ? | 9 Yes | 1 No |
Answer / rajavel
ya... pointer can be used in c# for value and array
types...and in inside class too (but class-> reference type
so not applicable)in the class members which are not ref
type../ using fixed keyword ... but it is unsafe....
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / varsha vilas kalebag
yes, pointer is nothing but value is saved in another
memory address
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / preeti
Yes pointers are supported in c#.
Def:- pointers point to other veriable's memory address.
Uses:-
i)It uses in call by reference concept.
ii)Number of pointers can point to same memory address.
iii)using pointer there is working on exact memory location
instead of other veriable.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / kiran
yes we can use pointers same as in c++ and c but pointer concept is not supported in c# but we can implement using interface concept
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / baru
yes,pointers can support in c#.Basically variables can hold and work on values of data types but pointers can work on addresses of those variables so memory space utilization will be efficient as these pointers works on available memory spaces
| Is This Answer Correct ? | 0 Yes | 0 No |
#include <stdio.h> #include <alloc.h> #include <stdlib.h> #include <conio.h> void insert(struct btreenode **, int); void inorder(struct btreenode *); struct btreenode { struct btreenode *leftchild; struct btreenode *rightchild; int data; }; main() { struct btreenode *bt; bt=(struct btreenode *)NULL; int req,i=1,num; clrscr(); printf("Enter number of nodes"); scanf("%d",&req); while(i<=req) { printf("Enter element"); scanf("%d",&num); insert(&bt,num); i++; } inorder(bt); } void insert(struct btreenode **sr, int num) { if(*sr==NULL) { *sr=(struct btreenode *)malloc (sizeof(struct btreenode)); (*sr)->leftchild=(struct btreenode *)NULL; (*sr)->rightchild=(struct btreenode *)NULL; (*sr)->data=num; return; } else { if(num < (*sr)->data) insert(&(*sr)->leftchild,num); else insert(&(*sr)->rightchild,num); } return; } void inorder(struct btreenode *sr) { if(sr!=(struct btreenode *)NULL) { inorder(sr->leftchild); printf("\n %d",sr->data); inorder(sr->rightchild); } else return; } please Modify the given program and add two methods for post order and pre order traversals.
Tell us about yourself.
47 Answers ABB, Amazon, Fidelity, Flextronics, Franklin Templeton, HCL, Hexaware, IBM, Impetus, Infosys, Reliance, Rofous, Silgate, Sutherland, TCS, Thomson Reuters, Virtusa, Wipro,
What is the renewal class?
sir i want to know which posting to apply since i am BE CSE.. also want to know what are the rounds there for my interview...Expecting for ur valuable answer....
How to hide the base class functionality in Inheritance?
1.explicit call for destructor 2.calling function inside a constructor. 3.base *b-new derived delete b; 4.delete p what it will delete. 5.size of base class and derived class int i,in base class and int j in derived. 6.int i-20 int main() { int i =5; printf("%d".::i); { int i =10; printf("%d".::i); } } 7.object slicing 8.new 9.function overloading(return type). 10.class base() { virtuval fun() { ----- } } class derivied:public base() { fun() { ----- } } int main() { derived d; } 11.how static function will call in C++? 12.default structures are in C++? 13.constructors should be in public . 14.virtuval constructor not exist. 15.multilevel inhritence. destructor order.
Explain the concept of abstracion and encapsulation with one example. What is the difference between them?
is java purely oop Language?
49 Answers HCL, Infosys, TCS,
#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; wow *b; a.x = 22; b = &a; a.x = 23; cout << b->x; return 0; }
What is a null tree?
What is the significance of classes in oop?
What is public, protected, private?