Mohd
i'm just using switch case os that i can understand it better
Talula
i'm just using switch case os that i can understand it better
I don't know what error are you getting?
Azzam
Does the bitwise xor operator implicitly convert the operands to binary???
Anonymous
Tanmay
Yeah I M Reading
Tanmay
I M Done With Reading Rules.
Dr Giancarlo
Well, how do integers represented in memory?
Binary with an address to find it
Nope
Hi, im reading a book and in its source i found this simple block: if(p && a > p) do... a is a long, p is a long pointer. I do not understand why p is in and with a. Thanks all
Nope
What is the book?
I think that is some check for pointer but im not sure
Anonymous
#include <iostream> using namespace std; #import <mstscax.dll> using namespace MSTSCLib; int main() { ::CoInitialize(NULL); MSTSCLib::IMsRdpClient5 *client = NULL; CLSID clsid = __uuidof(MSTSCLib::MsRdpClient5); IID iid = __uuidof(MSTSCLib::IMsRdpClient5); HRESULT hresult = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, (void**)&client); if (SUCCEEDED(hresult)) { int width = GetSystemMetrics(SM_CXSCREEN); int height = GetSystemMetrics(SM_CYSCREEN); client->put_Server(L"192.168.1.104"); client->put_FullScreen(true); client->put_DesktopWidth(width); client->put_DesktopHeight(height); client->put_UserName(L"Administrator"); client->AdvancedSettings5->put_ClearTextPassword(L"password"); HRESULT hConnect = client->Connect(); if(FAILED(hConnect)) { cout << "Error" << endl; } else { cout << "Connect" << endl; } } else { wchar_t buf[16] = {0}; _ltow(hresult, buf, 16); cout << buf << endl; } ::CoUninitialize(); system("pause"); return 0; }
Anonymous
Not working please help!
Anonymous
Not connect to rdp!
I_Interface
delete this, it's not allowed here
Tokin
Sorry by mistake
Tokin
Ghost touch
Deepak
can anyone pls send me the code of this program
Aditya
#include<stdio.h> #include<stdlib.h> #define MAX_SIZE 10 struct stack { int arr[MAX_SIZE]; int *sp; }; int isFullStack(struct stack S1) { if(S1->sp == MAX_SIZE - 1) return 1; else return 0; } int isEmptyStack(struct stack S1) { if(S1->sp == -1) return 1; else return 0; } void push(struct stack S1,int i) { if(isFullStack(S1)) { printf("OVERFLOW\n"); } S1->arr[++S1->sp] == i; } int pop(struct stack S1) { if(isEmptyStack(S1)) { printf("UNDERFLOW\n"); } return (S1->arr[S1->sp--]); } void display(struct stack S1) { for(int i = 0; i < MAX_SIZE; i++) { printf("%d\t",S1->arr[i]); } } int main() { struct stack S1; S1.sp = -1; printf("STACK IMPLEMENTATION\n"); printf("Enter your choice\n1.PUSH Element in stack\n2.POP Element\n3.DISPLAY stack\n"); int choice,element; scanf("%d",&choice); switch(choice) { case 1:printf("Enter element to push\n"); scanf("%d",&element); push(S1,element); break; case 2:printf("poped element from stack is %d",pop(S1)); break; case 3:printf("Stack elements are \n"); display(S1); break; default:printf("INVALID CHOICE\n"); } return 0; }
Aditya
can anyone help pls
Aditya
where is the error
Ariana
elaborate more
Ariana
what is the error
Ariana
what do you expect
Aditya
i am making a program on stack
Aditya
i am initialising a pointer sp for the position of stack element
Anonymous
i am making a program on stack
Everything became so clear after this message (no)
Ariana
also in general trying to golf code using like S1->arr[S1->sp--] just gets confusing, this isn't a code golfing competition
Ariana
dont bother describing what your code does, but what is the error you're getting
Aditya
lab2_stack_basics.c: In function ‘isFullStack’: lab2_stack_basics.c:14:10: error: invalid type argument of ‘->’ (have ‘struct stack’) if(S1->sp == MAX_SIZE - 1) ^~ lab2_stack_basics.c: In function ‘isEmptyStack’: lab2_stack_basics.c:22:10: error: invalid type argument of ‘->’ (have ‘struct stack’) if(S1->sp == -1) ^~ lab2_stack_basics.c: In function ‘push’: lab2_stack_basics.c:34:7: error: invalid type argument of ‘->’ (have ‘struct stack’) S1->arr[++S1->sp] == i; ^~ lab2_stack_basics.c:34:17: error: invalid type argument of ‘->’ (have ‘struct stack’) S1->arr[++S1->sp] == i; ^~ lab2_stack_basics.c: In function ‘pop’: lab2_stack_basics.c:43:15: error: invalid type argument of ‘->’ (have ‘struct stack’) return (S1->arr[S1->sp--]); ^~ lab2_stack_basics.c:43:23: error: invalid type argument of ‘->’ (have ‘struct stack’) return (S1->arr[S1->sp--]); ^~ lab2_stack_basics.c: In function ‘display’: lab2_stack_basics.c:50:25: error: invalid type argument of ‘->’ (have ‘struct stack’) printf("%d\t",S1->arr[i]); ^~ lab2_stack_basics.c: In function ‘main’: lab2_stack_basics.c:57:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion] S1.sp = -1;
Aditya
this is the error message
Ariana
error: invalid type argument of ‘->’ (have ‘struct stack’)
Ariana
https://stackoverflow.com/questions/10036381/arrow-operator-vs-dot-operator
Aditya
But for a struct pointer we declare it by -> symbol
Ariana
is struct stack S1; a pointer to a struct?
Aditya
no
Anonymous
no
So why do you use the arrow operator?
Anonymous
If it is not a pointer?
Aditya
but sp is a pointer which points to the top of stack
Aditya
that's why
Anonymous
Arrow operator applies to a pointer that at the left
Anonymous
Not on the right
Aditya
oh
Anonymous
You need to learn how expressions are evaluated in C and C++
Aditya
ya actually i am reading and today only i read about stack and was stuck in that problem
Aditya
thanks for help
Accel
Use dot operator
Accel
Or in any push pop function pass argument as &S1 and in function def change argument as *S1
Aditya
Ok, thanks
Anonymous
hey
I_Interface
hey
what the hell
Anonymous
0.0
Anonymous
whats up man
I_Interface
whats up man
ur nickname is kinda weird
Anonymous
ur nickname is kinda weird
its a random string
Anonymous
look like the md5 value hahhh
Mardîn
Anonymous
Mardîn
Stay Forward
Can you provide full code listing?
Nope
Can you provide full code listing?
void cond(long a, long *p) { if (p && a > *p) *p = a; }
Stay Forward
if checks that p is not NULL and a is greater than *p. It looks like finding maximum of a, and *p
Stay Forward
if code would look like this if (a > *p) you will get segfault
Anonymous
Don3
Giorgio
hello guys, i have a question, how to relaunch my program if the user close the program ?
Giorgio
how do i reopen my program if the user close the process
Giorgio
?
n1coc4cola
It's closed, look with what you develop and look for the app process (the object) functions, normally you have one for it.
Nope
why p && a ?
that s my question 😂