Skip to content

producing wrong result #105651

@ghost

Description

We have written the needed data into your clipboard because it was too large to send. Please paste.
Issue Type: Bug

i tried same code on online ide it is giving different result.
i tried same code on codechef and geeksforgeeks they are displaying Null. WHEN I AM POSTING THIS POST HERE IOSTREAM AFTER INCLUDE AND ALL ASTERISKS ARE NOT DISPLAYING IN THIS POST PLEASE CONSIDER THEM.
#include
using namespace std;

struct node{
int data;
struct node next;
};
struct node
head;

int main(){
struct node head = (struct node) malloc(sizeof(struct node));

if (head->next==NULL){
cout<<"Null"<<endl;

}
else{
cout<<"Not Null"<<endl;
}

return 0;
}
Actuall result: Not Null
Expected result: Null
image
image

VS Code version: Code 1.48.2 (a047975, 2020-08-25T10:13:11.295Z)
OS version: Windows_NT x64 10.0.18363

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz (8 x 1992)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.85GB (3.85GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (16)
Extension Author (truncated) Version
vscode-intelephense-client bme 1.5.4
vscode-css-modules cli 0.2.3
c-cpp-compile-run dan 1.0.11
vscode-html-css ecm 0.2.3
prettier-vscode esb 5.5.0
php-debug fel 1.13.0
php-intellisense fel 2.3.14
php-pack fel 1.0.2
code-runner for 0.11.0
php-awesome-snippets hak 1.1.3
python ms- 2020.8.105045
cpptools ms- 0.30.0-insiders3
LiveServer rit 5.6.1
python tht 0.2.3
full-react-snippets wal 1.4.2
html-css-class-completion Zig 1.19.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    info-neededIssue requires more information from poster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions