language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.c
* Author: Vitor
*
* Created on 8 de Junho de 2018, 11:11
*/
#include <stdio.h>
#include <stdlib.h>
/*
*
... |
C | /*
* The Towers Of Hanoi
* C
* Copyright (C) 1998 Amit Singh. All Rights Reserved.
*
* Tested with, ah well ... :)
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define FROM 1
#define TO 3
#define USING 2
void
dohanoi(int N, int from, int to, int using)
{
if (N > 0) {
dohanoi(N-1, from, u... |
C | /*分数求和*/
#include <stdio.h>
long long gcd(long long a,long long b)//求最大公约数。
{
if(a == 0)
return 0;
else
return (b == 0) ? a : gcd(b, a % b);
}
int main()
{
int N;
long long lcp;//用以记录最小公倍数
long long a,b,c,d;
int i = 1;
scanf("%d",&N);
scanf("%lld/%lld",&a,&b);
in... |
C | #include <stdlib.h>
#include <stdio.h>
#include "header.h"
int checkCollision(BoundingBox box1, BoundingBox box2) {
/*printf("box1 : %f %f %f %f\n", box1.pMinX, box1.pMaxX, box1.pMinY, box1.pMaxY);
printf("box2 : %f %f %f %f\n", box2.pMinX, box2.pMaxX, box2.pMinY, box2.pMaxY);*/
/* Collisions par l'avant */
if ... |
C | #include <stdio.h>
#include <malloc.h>
#include <math.h>
#include <memory.h>
/*
* License:
* CC BY 4.0
*
* Author: DrMarcel
*/
/*
* Infos:
* YUV, 4:2:0
* CIF:352x288 -> Luminanz
* 176x144 -> Chrominanz
* Framerate:30Hz
*
* Dateiaufbau
* Bild 1 YUV , Bild 2 YUV, Bild 3 YUV, ...
* 1byte pro px
*
*/
... |
C | /*-----------Matrice de covariance pour un processus Ornstein-Uhlenbeck-------------------------*/
/*-mvMORPH 1.0.3 - 2014 - Julien Clavel - julien.clavel@hotmail.fr/julien.clavel@univ-lyon1.fr--*/
#include "mvmorph.h"
// Fixed root covariance matrix
static void mvmorph_covar_OU_fixed(int *nt,
double *A,
... |
C | //>>> 使用参数
#include<stdio.h>
int main(int argc, char** argv)
{
while(*++argv!=NULL)
{
printf("%s ", *argv);
}
if(argc>1)
printf("\n");
return 0;
}
|
C | #include "types.h"
#include "stat.h"
#include "user.h"
void small_stack()
{
char name[256] = "small-stack()";
int i = 0;
char j[20];
uint k = 97;
for(i = 0; i < 20; i++)
{
j[i] = k++;
}
printf(1,"name: \"%s\" address: %d\n",name, &name);
printf(1,"i: %d address: %d\n",i, &i);
for(i = 19; i >= 0; i--)
... |
C | /**
* Gauss-Seidel implementation using pthreads.
*
*
* Course: Advanced Computer Architecture, Uppsala University
* Course Part: Lab assignment 3
*
* Original author: Frdric Haziza <daz@it.uu.se>
* Heavily modified by: Andreas Sandberg <andreas.sandberg@it.uu.se>
*
*/
#include <pthread.h>
#include <stdio.h>... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_DB_LENGTH 1000
struct directoryDB {
int num;
char element[100];
char isLast;
};
struct mapDB {
char element[100];
char map[20];
};
struct directoryDB dirDB[MAX_DB_LENGTH];
struct mapDB mDB[MAX_DB_LENGTH];
int dirDB_len = 0;
int mDB_len = 0;... |
C | //使用pthread_create函数实现线程的创建
#include<stdio.h>
#include<stdlib.h>
#include<pthread.h>
void* task(void *p)
{
while(1)
printf("我是子线程\n");
}
int main(void)
{
//启动一个新的线程
pthread_t tid;
pthread_create(&tid,NULL,task,NULL);
usleep(100000);
return 0;
}
|
C | //Code by AkshayKumar Prakash Mantriwar TY CSE A-DIV
#include<stdio.h>
void main(){
int adj[20][20],n,i,j,c=0,k,d=0,S[20],sindex=0,Q[20],min=999,counter=0;
char vertices[20],Q1[20];
scanf("%d",&n);
for(i=0;i<n;i++){ //get the adj matrix
for(j=0;j<n;j++){
scanf("%d",&adj[i][j]);
}
}
scanf("%s",&vertices); /... |
C | #include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
struct sockaddr_in addr;
if (inet_aton("10.0.0.1", &addr.sin_addr)) {
for (int i = 0; i < 4; i++) {
printf("%d ", (addr.sin_addr.s_addr >> (i * 8)) & 0xff);
}
... |
C | #include <stdio.h>
#include <string.h>
// PART 2
void findStr() {
char smallest_word[20] = "zzzzzzzzzzzzzzzzzzzz"; //biggest string possible in dictionary order
char largest_word[20] = ""; // smallest string possible
char input[20];
// if (strcmp("cat",smallest_word) > 0) {
// strcpy(smal... |
C | /* Copyright 2011 Tom Jollans <t@jollybox.de>
* This code is under the Chicken Dance License v0.1 */
#include <stdio.h>
#include "card.h"
char *irc_print_card (card_t card, int color, int utf8)
{
static const char *red_start = "\x03" "4 ";
static const char *red_end = "\x03";
static char result[32];
... |
C | #include "Dev_Inf.h"
/* This structure containes information used by ST-LINK Utility to program and erase the device */
#if defined (__ICCARM__)
__root struct StorageInfo const StorageInfo = {
#else
struct StorageInfo const StorageInfo = {
#endif
.DeviceName = "W25Q32FV_STM32F730", // Device Name + version n... |
C | #include<stdlib.h>
/* The function get_len
* returns the length of the input number
* It takes a argument (unsigned long void) and
* returns length of number (int)
*/
int get_len (long value){
int l=1;
while(value>9)
{
l++;
value/=10;
}
return l;
}
/* The function power computes the pow... |
C |
#include <stdarg.h>
#include "util/util_printer.h"
/**
* Print the string to stream with the selected color and add a newline if newline is true
* @param stream Stream pointer output
* @param color The Color
* @param format The String
* @param newline Add a newline at the end
* @param args Format tags
*/
stati... |
C | #include <stdio.h>
#include <math.h>
int main() {
float sqrt(float x) {
float e = 0.000001, g2 = x/2, g1;
do {
g1 = g2;
g2 = (g1 + x/g1)/2;
} while(((g2 - g1)/g2) * ((g2 - g1)/g2));
return g2;
}
return 0;
}
|
C | #pragma once
#include "stdafx.h"
typedef struct
{
unsigned char packet[1500]; //һݰͷ
int packet_len; //ݰЧ freadʱõ
int ID; //IDʱ丳ֵ
} PAC;
struct Stream_list //
{
UINT32 src_addr;
UINT32 dst_addr;
UINT16 src_port;
UINT16 dst_port; //ipͶ˿Ϊĵһʶ
int stream_ID; //IDΪĵڶʶ ΪͬipͶ˿пܵڶνӡ
//STR... |
C | /*
* main.c
*
* Created on: Dec 31, 2015
* Author: m.mamdooh
*/
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include <ctype.h>
static const long hextable[] = {
[0 ... 255] = -1, // bit aligned access into this table is considerably
['0'] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, //... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
struct timeval tv1,tv2;
int rs, i;
char key[4096]; // ũ. δ پ ũ⸦ ó ־ .
char value[256]; // ũ. δ پ ũ⸦ ó ־ .
char bu... |
C | /* pe14-5.c -- student */
#include <stdio.h>
#define CSIZE 4
struct name {
char first[20];
char last[20];
};
struct student {
struct name st_name;
float grades[3];
float average;
};
void print_student(struct student * pstudent);
int main(void)
{
struct student students[CSIZE];
float averag... |
C | /*
* Copyright (c) 2010 Scott Vokes <vokes.s@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS I... |
C | //Question de l'exam
1()
int i = 5;
int j = 2;
printf("%f",1.5+(float)(i+1)/(float)j+5/j);
=> 1.5+6.0/2.0+5/2
=> 1.5+6.0/2.0+2
=> 1.5+3+2
=> 6.5 => Réponse
2()
int *ptr,*tmp,*v;
int a;
v=&a;
ptr=v;
tmp=ptr;
v=ptr;
=> QCM 3 propositions => Tout pointe vers a
3()
int i = 0;
int v = 0;
while(i == 0 || v == 20)
{
if... |
C | #include <stdio.h>
#include <stdlib.h>
#include "hw6.h"
int main()
{
FloatList *aList = CreateFloatList();
if(NULL == aList)
{
return -1;
}
AddFloatValue(aList,3.283);
AddFloatValue(aList,3.243);
AddFloatValue(aList,8.143);
AddFloatValue(aList,9.944);
AddFloatValue(aList,6.193);
AddFlo... |
C | /*
Author: Dung Harry
Date created: 22nd, December 2013
Operating System: Ubuntu 13.10 Desktop x86_64
Compiler: GNU compiler 4.4.0
Description: this is the testing source code for shared library
in C programming language
Compile this source code into shared library by following
commands:
gcc -c -fpic Shared... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#define NUM_THREADS 2
typedef struct rectangle_t
{
double length;
double width;
} rectangle;
void *thread_function(void *arg)
{
rectangle *r = (rectangle *)arg;
float r_length = r->length;
float r_width = r->width;
float r_area = r_l... |
C | /*Code to test bluetooth serial connection
using android phone with app inventor app
as device to connect to....
Module: HC-05
baud=9600
Author: Jose Estrada
*/
#include <stdio.h>
#include <string.h>
#include <wiringPi.h>
#include <wiringSerial.h>
//GPIO pin setup
#define motor1 0
#define motor2 1
#defin... |
C | #include "grammar.h"
#include <stdio.h>
#include <stdlib.h>
TryVariable_t parse_typedef(const ConstString_t str) {
TryVariable_t output;
TryConstString_t typedef_str = find_string(str, const_string_from_cstr("typedef"));
if (typedef_str.status == TRY_SUCCESS) {
ConstString_t working = strip(str, t... |
C | #include <stdio.h>
#include <signal.h>
void myHandler()
{
printf("Signal caught\n");
}
int main()
{
struct sigaction handler;
handler.sa_handler = myHandler;
sigaction(SIGALRM,&handler,NULL);
while(1)
{
alarm(5);
pause();
}
return 0;
}
|
C | //hashmap.h
#ifndef HASHMAP_H
#define HASHMAP_H
typedef struct hashmap_t hashmap_t;
typedef int (*equals_callback_t)(void*,void*);
typedef int (*hashcode_callback_t)(void*);
hashmap_t* new_map(equals_callback_t equals_callback,hashcode_callback_t hashcode_callback);
hashmap_t* new_map_with_init_capacity(equals_cal... |
C | #include <stdio.h>
int main(){
int i, w, backup_i;
printf("N\t Bin\t Oct\t Hex\n");
/* Istruzioni per ogni riga */
for(i=0; i < 20; i++){
printf("%d\t", i); /* Stampa il numero della riga*/
backup_i = i;
/* Inizio Stampa binario */
for(w = 128; w > 0 ; w/= 2){
print... |
C | /***********************************************************************
*
* Name: comdrtst
*
* Purpose: Test program for comdrive read and write
*
* Algorithm: Tests both comdrive for both input (com_read)
* and output (com_write)
*
*******************************************************************... |
C | #include <stdio.h>
int main()
{
int num1 = 10;
int num2 = 20;
int *ptr1 = &num1;
int *ptr2 = &num2;
int *tmp;
(*ptr1)+=10;
(*ptr2)-=10;
tmp = ptr1;
ptr1 = ptr2;
ptr2 = tmp;
printf("%d %d\n", *ptr1, *ptr2);
return 0;
}
|
C | /*============================================================================
CSci5103 Spring 2016
Assignment# : 4-2
Name : John Erickson
Student id : 2336359
x500 id : eric0870
CSELABS machine : csel-kh4250-03.cselabs.umn.edu
==========================================... |
C | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
#include <malloc.h>
#include <stdio.h>
#include <stdbool.h>
struct ListNode
{
int val;
struct ListNode *next;
};
int addNode(struct ListNode *l1, struct ListNode *l2, int inc)
{
int value... |
C | #include <stdio.h>
#include <stdbool.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
#define Max_Buf 50
#define Max_Buf_Read 6
bool IsParent = false;
bool parent_running = false;
int counter =0;
int Wr... |
C | #include <pebble.h>
#include "cue_sheet_data.h"
int cue_sheet_data_get_distance(cue_sheet_data_t* data) {
return (data->ride_list[data->ride_number].ride[data->cue_number].distance);
}
char* cue_sheet_data_get_description(cue_sheet_data_t* data) {
return (data->ride_list[data->ride_number].ride[data->cue_number].... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init_process_arena.c :+: :+: :+: ... |
C | //sending a msg to a specific queue(already created msgQ)..(all manipulated through comdline arg only)
#include"./headers.h"
void msq_details(int msqid){
struct msqid_ds buf;
msgctl(msqid,IPC_STAT,&buf);
printf("created msgQid: %d type: %ld size = %d bytes\n",msqid,msgp.mtype,len);
printf("max no of bytes a... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* vertex_manager.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<maps.h>
#include<files.h>
void set_rect_map(MAP* m,int y,int x,char wall){
int i,j;
m->cinfo = '0';
m->campo = (char**)malloc(sizeof(char*)*y);
for(i=0;i<y;i++){
m->campo[i] = (char*)malloc(sizeof(char)*x);
}
... |
C | #ifndef __ELEMENTYPPE__
#define __ELEMENTTYPE__
#include <stdio.h>
#include <stdlib.h>
#define MAX_ 255
typedef struct {
int num;
char name[10];
}Element;
typedef struct {
Element ele[MAX_];
int length ;
}Seqlist;
#endif
|
C | #include "header.h"
/*
* Main function to all of our goodies
* argv[1] localhost
* argv[2] client IP
*/
int main(int argc, char *argv[])
{
// Declare our server socket
my_socket receiver =
{
"",
"",
{
.sin_family = AF_INET,
.sin_port = htons(... |
C | #include "NMUSocket.h"
#include "fortuneClient.h"
void handleOptions(int argc, char *argv[], char **hostNamePtr, char **portPtr);
bool shouldQuit(void);
int handleFortuneReply(nmu_socket_t pSocket);
int main(int argc, char *argv[])
{
nmu_socket_t pSocket;
char *portno;
char *hostName;
handleOptions( argc, arg... |
C | /*-----------------------------------------------------------------------*
* Multilevel Incomplete QR Factorization *
*-----------------------------------------------------------------------*
* Na Li, Mar, 2005 *
* ... |
C | #ifndef PERSON_H
#define PERSON_H 1
typedef enum Bool{true=1,false=0}bool;
typedef struct Person{
char name[20];
bool gender;
int age;
double salary;
}person;
//struct Personһṹ
#endif
|
C | /*
* @lc app=leetcode id=696 lang=c
*
* [696] Count Binary Substrings
*
* https://leetcode.com/problems/count-binary-substrings/description/
*
* algorithms
* Easy (53.46%)
* Total Accepted: 31K
* Total Submissions: 58.1K
* Testcase Example: '"00110"'
*
* Give a string s, count the number of non-empty (... |
C |
#include "raylib.h"
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib example.");
SetTargetFPS(60); ... |
C | #include<stdio.h>
#include<conio.h>
#include<string.h>
enum NT{E=0,e=1,T=2,t=3,F=4};
int top=0,ci=0;
char table[5][6][4]={"\0"},exp[20],st[20];
int flag=0;
void parser(void);
void push(char);
void pop(void);
int p_table(char);
void create_table();
void main()
{
int l,m,n,lp=0;
char t;
clrscr();
printf("Give Expr... |
C | /*Generalize o código acima para qualquer frequência possível.*/
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
int fd;
//função para fechar corretamente e unexportar os pinos
void close(){
close(fd);
fd = open("/sys/class/gpio/unexport",O_WRONLY);
write(fd,"4",2)... |
C | #include <bits/stdc++.h>
#include <limits.h>
using namespace std;
// Number of cities in TSP
#define V 5
// Names of the cities
#define GENES ABCDE
// Starting Node Value
#define START 0
// Initial population size for the algorithm
#define POP_SIZE 10
// Structure of a GNOME
// string defines the path trav... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
void copy(char *c, char *x)
{
char str[1000];
FILE *C, *X;
C = fopen(c, "r");
X = fopen(x, "w");
char i;
while ((i = fgetc(C)) != EOF)
{
fputc(i, X);
}
}
int main()
{
setlocale(0, "Russian");
char a[1000], b[1000];
printf("Введите путь к р... |
C | #include<stdio.h>
#include<math.h>
int main(){
printf("Enter any Number");
int number;
scanf("%d",&number);
int squaredNumber = number * number ;
int lastDigits = 0;
int counter = 0;
int number_cpy = number;
while(number){
lastDigits += (squaredNumber %10)*pow(10,counter);
squaredNumber = squaredNumber/10;
... |
C | #include <iostream>
#include <fstream>
#include <cmath>
#include "random.h"
#include <string>
#include "esercitazione81.h"
#include <iomanip>
using namespace std;
//Esercizio 8.1
//
int main(){
rnd.LoadSeed();
settings(); //Inizialization
for(int i=0; i<par;i++){
for(int j=0; j<par;j++){
sigma=sigmapar[i]... |
C | /****************************************************************************
* libs/libc/signal/sig_raise.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright owne... |
C | # include <stdio.h>
unsigned int replace(unsigned int x, int i, unsigned char b)
{
unsigned int x2;
switch(i) {
case 0:
x2 = x&0xFFFFFF00;
break;
case 1:
x2 = x&0xFFFF00FF;
break;
case 2:
x2 = x&0xFF00FFFF;
break;
case 3:
x2 = x&0x00FFFFF... |
C | /*
array.h
foundation
Created by Christopher Loonam on 11/8/15.
Copyright (c) 2015 Christopher Loonam. All rights reserved.
*/
#ifndef __foundation__array__
#define __foundation__array__
#include <stdio.h>
/**
@brief @c array_t is a structure that holds an ordered collection of objects of any type.
*/
type... |
C | #include <stdio.h>
int main() {
int op1, op2, sum; // variable declaration
op1 = 5; // variable definition
op2 = 3;
sum = op1 + op2; // addition operation just change sign for other operation ex substraction , multiplication , division etc..
printf("sum of %d and %... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include "main.h"
void build_wheel()
{
roulette = malloc(sizeof(int) * population_fitness);
int *ptr = roulette ;
int i = 0 ;
int j = 0 ;
for(; i < POP ; i++){
for(j = 0 ; j < fitnesses[i] ; j++){
*(ptr++) = i ;
}
}
}
void initialize_population()
{
int i = 0 ;
... |
C | #include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
volatile uint8_t counter = 0;
ISR (TIMER0_OVF_vect){ // Timer0 ISR
counter++;
TCNT0 = 6; // for 1 sec at 16 MHz
}
int main(){
DDRB = DDRB | (1<<5); // set pin 5 of port B for output
TCNT0 = 6; ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<omp.h>
//Dimension por defecto de las matrices
int N=100;
//int N=3; <-- para testear, la cambiamos por 3
//Asignamos un numero fijo de threads, también podrían llegar por parámetro
int numThreads=4;
struct celda {
double pos;
double value;
} valor, *col... |
C | ### 1.Pattern 1 ###
*****
*****
*****
*****
*****
#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
printf("*",i);
printf("\n");
}
return 0;
}
### 2.Pattern 2 ###
*
**
***
****
*****
#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<=5... |
C | #include <stdio.h>
#include <stdlib.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#define ALPHABET_SIZE 26
char * encrypt(string plain, int cipher_key);
int main(int argc, string argv[])
{
// Checks if there is a command line agrument passed for Key
if (argc != 2)
{
printf("Missing ... |
C | #include <SDL.h>
#include <stdio.h>
#include <stdbool.h>
#include "graphics.h"
#include "game.h"
int main(void)
{
Game game;
// startup SDL, game window, and whatnot
bool check = startup(&game.window);
if (!check)
{
printf("Game startup failed!\n");
return 1;
}
// start a new game (i.e. intialize a blan... |
C | #include "STD_TYPES.h"
#include "BIT_MATH.h"
#include "UART_private.h"
#include "UART_config.h"
#include "UART_interface.h"
/************************************************************/
void UART_VoidInit (void)
{
u8 ucsra =0b00000000;
u8 ucsrb =0b00011000;
u8 ucs... |
C | #ifndef STDDEF_H_
#define STDDEF_H_
#define NULL 0
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned int uint;
static void memclear(uint8* p, int len) {
for (int i = len; i > 0; i-... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "buffer_mgr.h"
#include "dberror.h"
#include "storage_mgr.h"
#define MAX_PAGES 20000
#define MAX_FRAMES 200
#define MAX_K 10
/*Frame list operations*/
/* Auxiliary function */
/*
Create a new pageframe node in frame list
*/
pa... |
C | #include "boot_systicks.h"
#include "boot_regmap.h"
static volatile uint32_t g_u32SysTickCount = 0;
/**
* @brief This function is init system tick module.
* @note ticks should be the CPU frequency, then the count interval should be 1ms.
* @retval None
*/
void SysTicks_Init(uint32_t ticks)
{
if... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fillers1.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAXN 200001
int Compare(const void *a, const void *b){
return *(int *)a - *(int *)b ;
}
int main()
{
int n, k;
unsigned long long int count = 0;
int a[MAXN] = {0};
scanf("%d %d", &n, &k);
for(int i = 0; i < n; i++){
scanf("%d", &a[i]);
... |
C | /* Write a program to count the number of occurrences of any two vowels insuccession in a line of text.
for example , in the sentence "Please read this application and give me gratuity"
such occurrences are ea, ea, ui*/
#include <stdio.h>
#include <string.h>
int is_vowel(char vowel);
int main(void)
{
char array[... |
C | /** @file
Byte Swap routines for endian-nes conversions.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the licen... |
C | #include <stdio.h>
#include <unistd.h>
#include "zenoh.h"
#include "zenoh/codec.h"
int main(int argc, char **argv) {
char *locator = strdup("tcp/127.0.0.1:7447");
if (argc > 1) {
locator = argv[1];
}
printf("Connecting to %s...\n", locator);
z_zenoh_p_result_t r_z = z_open(locator, 0, 0);
ASSERT_RESU... |
C | #include<stdio.h>
int main() {
int i, num, countPares=0, countImpares=0, countPositivos=0, countNegativos=0;
for(i=0; i<5; i++) {
scanf("%d", &num);
if(num%2 == 0) {
countPares++;
}
if(num%2 != 0){
countImpares++;
}
if(num > 0) {
countPositivos++;
}
if(num < ... |
C |
/**
* @file CodeQ1_server.c
* @brief This file is used for the server side creation of node created using TCP protocol and
* IPv4 and to send and listen to the messages
* through the port and also to connect with other client sockets.
*
* @author Abhishek Rathod (17114004)
*
* @date 1/10/2019
*/
#include <unistd.h>... |
C | #include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
struct Person
{
int month;
int day;
int year;
int number;
};
int main(int argc, char* argv[])
{
//Define a variable p of type struct Person
struct Person p;
p.month = 10;
p.day = 13;
p.year = 2016;
p.number = 1234;
printf("Person %d:\n\tDate: %... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | //#define TEST
#include <stdlib.h>
//#include "../my_malloc.c"
#include "lang.h"
#ifdef TEST
#include <stdio.h>
#endif
int eval_stmt(Def* def, Stmt* stmt, ProgramState* s);
int eval_expr(Def* def, Expr* e, ProgramState* s) {
int * values = s->vars;
int l, r;
if (e->type == TConst) {
return ((Const *)e->p)->val;... |
C | int* data;
int find(int x) {
return data[x] == x ? x : (data[x] = find(data[x]));
}
void merge(int x, int y) {
if (find(x) != find(y)) data[find(x)] = find(y);
}
int count(int N) {
int cnt = 0;
for (int i = 0; i < N; i++)
cnt += data[i] == i;
return cnt;
}
int findCircleNum(int** M, int ... |
C | //
// Created by aaron on 10/13/16.
//
#include <stdlib.h>
#include "pow.h"
#include "util.h"
long Pow(long X, unsigned long N) {
unsigned int n = msb(N);
long* powersOfX = malloc(n * sizeof(long));
powersOfX[0] = X;
for (int i = 1; i < n; ++i) {
powersOfX[i] = powersOfX[i-1] * powersOfX[i-1];... |
C | #include <stdio.h>
#define MAXNUM 20
int main()
{
int i, testn, n[MAXNUM];
testn = 8;
for (i = 0; i < MAXNUM; i++)
n[i] = i;
for (i = 0; i < MAXNUM; i++) {
if (n[i] == testn) {
printf("break at %d\n", n[i]);
break;
}
printf("%d ", n[i]);
}
... |
C | #include <stdio.h>
int checkdiag (int **matrix, int size); /*Declaring Function prior to main function.(Required unless function is already placed before main*/
int
main(void)
{
int size, i, p;
int **mat;
/*Using pointer because you cannot declare an array with varibles, only with numbers. Since w... |
C | #include <stdio.h>
void print(char str[])
{
printf("Your Name: ");
puts(str);
}
int main()
{
char string1[30];
char string2[30]
int result;
printf("Enter First and Last name: ");
gets(string1);
gets(string2);
print(string1);
print(string2);
result = strcmp(string1, string2);
printf("strcmp(string1,stri... |
C | #include "heap_lib.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INT_MAX 9999999
void
min_heapify(hNode *ptr, int i, int size)
{
//printf("\nInside max heapify\n");
int smallest = i;
int left = (2 * i) + 1;
int right = (2 * i) + 2;
hNode *temp = NULL;
... |
C | #include<stdio.h>
#include<unistd.h>
int ft_iterative_power(int nb, int power)
{
int i;
if (power < 0)
return (0);
if (power == 0)
return (0);
i = nb;
while (power > 1)
{
nb *= i;
power--;
}
write(1 &nb, sizeof(nb));
return (0);
}
int main(void)
{
ft_iterative_power(5,2);
}
|
C | #include <stdio.h>
#define N 10
int vett[N];
void scambia(int *a,int *b) {
int c;
c=*a; *a=*b; *b=c;
}
main() {
int i;
for (i=0;i<N;i++)
vett[i]=i;
for (i=N-1;i>=0;i--)
scambia(&vett[i],&vett[i%3]);
for (i=0;i<N;i++)
printf("%d ",vett[i]);
}
/* output
... |
C | #include <stdio.h>
int main(void){
float num1, num2;
puts("Ola, bem vindo.");
puts("Este programa exibe o menor dentre dois numeros digitados pelo usuario.");
printf("\nPara iniciar digite o primeiro numero: ");
scanf("%f", &num1);
printf("Agora digite o segundo numero: ");
scanf... |
C | #if 0
fwatch monitors files for changes
once a change is detected, an email containing the contents
of the file being monitored is sent
compilation:
gcc fwatch.c -Wall -Wextra -Werror -Wpedantic -D_GNU_SOURCE -O3 -o fwatch
usage:
./fwatch [filename] [email_recipient]
NOTE:
make sure that postfix ha... |
C | #include <stdio.h>
int main(void)
{
int n = 5;
while (n < 7)
{
printf("n=%d\n", n);
n++;
printf("Now n=%d\n", n);
}
printf("Done.\n");
return 0;
} |
C | /*************************************************************************
> File Name: server.c
> Author: stmatengss
> Mail: stmatengss@163.com
> Created Time: Sun Jan 22 22:48:12 2017
************************************************************************/
#include<stdio.h>
#include <stdlib.h>
#i... |
C |
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <glib.h>
#include "includes/common.h"
double product(int * items, int index) {
double res = 1.0;
for (int i=0; i<index; i++) {
if (items[i] != 0) {
res *= items[i];
}
}
return res;
}
int main() {
siz... |
C | #include <stdio.h>
/**
* main - prints the size of various types on the current machine
*
* Return: Always 0 (Success)
*/
int main(void)
{
char c;
int i;
long int long1;
long long int long2;
float f;
printf("Size of a char: %zd byte(s)\n", sizeof(c));
printf("Size of an int: %zd byte(s)\n", sizeof(i));
p... |
C | #include "monty.h"
/**
* pint - print the numbers add
* @node: is the element
* @line_number: line number
*/
void pint(stack_t **node, unsigned int line_number)
{
stack_t *node_pall = *node;
if (!node_pall)
{
fprintf(stderr, "L%u: can't pint, stack empty\n", line_number);
free(var.buff);
free_stack(*node)... |
C | #include <stdio.h>
#include <stdlib.h>
#include "binary_tree.h"
#include "stack.h"
BinaryTree *create_BinaryTree()
{
BinaryTree *new = (BinaryTree *)malloc(sizeof(BinaryTree));
(*new) = NULL;
return new;
}
int insert_BinaryTree(BinaryTree *root, int data)
{
if (root != NULL)
{
Node *new ... |
C | #include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
int data[10] = {0};
int fd;
int i;
int n;
fd = open("test2", O_RDONLY);
if (fd == -1)
{
perror("error!");
return (0);
}
n = read(fd, data, 5);
data[n] = 0;
printf("%s", data);
return (0);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "list_node.h"
//https://leetcode-cn.com/problems/partition-list/
struct ListNode* partition(struct ListNode* head, int x) {
struct ListNode *less_ptr = NULL;
struct ListNode *less_head = NULL;
struct ListNode *greater_ptr = NULL;
struct ListNode *geater_... |
C | /*!
* \file display.h
* \brief Functions that work with LEDS(two displays)
* COPYRIGHT: College of electrical engineering, www.etfbl.net
* This software was written in accordance to the guidelines at https://github.com/knezicm/battleship-8051/blob/master/LICENSE
* VERSION: 1.0, PF 2-OCT-17
*/
#ifndef DISPLAY_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.