language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "includes.h"
#include "BswDrv_Debug.h"
#include "BswDrv_Usart.h"
static __IO uint8_t gPrintBuff[164]; //ij
static volatile uint16_t gWrite = 0;
int fputc(int ch, FILE *f)
#if 0
{
usart_data_transmit(USARTX[USARTX_INDEX], (uint8_t)ch);
while(RESET == usart_flag_get(USARTX[USARTX_INDEX], USART_FLAG_... |
C | /*
** EPITECH PROJECT, 2020
** rpg
** File description:
** str to array
*/
#include "rpg.h"
int size_malloc_y(char *str, char sep)
{
int size_malloc = 0;
for (int i = 0; str[i]; i++) {
if (str[i] == sep)
size_malloc += 1;
}
return (size_malloc);
}
char **malloc_array(char *st... |
C | #include <stdio.h>
#include <malloc.h>
void snt(int n)
{
long i,kt,nt,s;
nt=0;
for (s=2;s<=n;s++)
{ kt=0;
for (i=2;i<s;i++)
{
if (s%i==0)
kt=kt+1;
}
if (kt==0)
// {
// printf("%d\t",s);
nt=nt+1;
// }
}
printf("\nCo %d so nguyen to!",nt);
}
void main()
{
long n;
printf("Nhap vao N: "... |
C | #ifndef _HELP_H_INCLUDED_
#define _HELP_H_INCLUDED_
char* help_str =
"\n"
"Usage: lolcat [OPTION]... [FILE]...\n"
"\n"
"Concatenate FILE(s), or standard input, to standard output.\n"
"With no FILE, or when FILE is -, read standard input.\n"
"\n"
" -F Rainbow frequency (default: 0.1)\n"
" -... |
C | /* ************************************************************************** */
/* LE - / */
/* / */
/* check_place_letter.c .:: .:/ . .:: ... |
C | #include "GameEngine.h"
#include "Nokia5110.h"
#include "Sprites.h"
#include "ADC.h"
#include "Sound.h"
#include "SwitchLED.h"
#include "Random.h"
#define MAX_CACTUS 2
#define MAX_VULTURE 1
#define WIN_SCORE 100
unsigned long FrameCount=0; //to anmate enemies while they move
unsigned long Distance; // un... |
C | #include <stdio.h>
#include <stdlib.h>
float power(float x, int k);
int main(){
printf("Stepenovanje %.2f na %d i rez je: %.2f\n",2.0,3,power(2.0,3));
return EXIT_SUCCESS;
}
float power(float x,int k){
int i;
float result=1;
for(i=0;i<k;i++)
result*=x;
return result;
}
|
C | //
// main.c
// Sigcomp
//
// Created by Artem Lenskiy on 15/03/2016.
// Copyright © 2016 Artem Lenskiy. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <memory.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327950288
#endif
#define BLOCK_SIZE 64
//static c... |
C | #include<stdio.h>
void main()
{
int r;
printf("Enter the number of rows : ");
scanf("%d",&r);
for(int i=1;i<=r;i++)
{
for(int j=1;j<=i;j++)
{
printf("*");
}
printf("\n");
}
}
|
C | #ifndef _NOTIFICATION_SERVER_H
#define _NOTIFICATION_SERVER_H 1
#include <time.h>
#include <sys/types.h>
/** @file
* A notifications server
*/
#ifndef MAP_ANONYMOUS
/**
* MAP_ANONYMOUS is undefined on Mac OS X
* but MAP_ANON (which is deprecated by POSIX) is
*/
#define MAP_ANONYMOUS MAP_ANON
#endif
/** maximum... |
C | #include <math.h>
int falsaposicao (double a, double b, int p, double (*f) (double x), double* r) {
int i = 0;
double c, fc;
double maxerr = 0.5 * pow(10.0, -p);
double fb = f(b);
do {
c = a - ( (f(a)*(b-a)) / (f(b) - f(a)) );
fc = f(c);
if (f(c) * fb < 0) {
a = c;
} else {
fb = ... |
C | #include "philosophers.h"
time_t get_time()
{
const time_t s_to_ms = 1000000;
time_t tmp1;
suseconds_t tmp;
t_time_sturct tv;
if (gettimeofday(&tv, NULL) == -1)
return 0;
tmp1 = tv.tv_sec - g_tv.tv_sec;
tmp = tv.tv_usec - g_tv.tv_usec;
if (tmp < 0)
{
tmp1--;
tmp += s_to_ms;
}
if (tmp1 > 0)
tmp += tm... |
C | #include <stdio.h>
//counting the characters in a stream
int main()
{
int ws = 0;
int c;
while((c = getchar()) != EOF)
{
if (c == 'w') {
ws++;
}
}
printf("the number of ws in the string is %d \n", ws);
}
|
C | #include <stdio.h>
#include <string.h>
#include "connect.h"
#include "http.h"
#define N_c 9
#define P_c 1
char test_connection[N_c + P_c][30] = {
// negative
"incorrect",
"1234",
"1270013030",
"127.0.0.1.3030",
"",
"127.incorrect.0.0.1:3030",
":",
// TODO poprawny adres, ale nie ma pod nim serwera "1... |
C | #include "holberton.h"
/**
* _strlen - returns the lenght of a string
* @s: pointer to s
*
* Return: 0 on success
*
*/
int _strlen(const char *s)
{
int count = 0;
if (s != '\0')
{
while (*(s + count) != '\0')
count++;
}
return (count);
}
/**
* binary_to_uint - converts a binary number to an unsigned i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#define PATH_MAX 2048
#define LINE_MAX 256 // Q.
#define COV_MAX 1024
/**
* White-Box Testing : derive tests from the implementation.
*
* Coverage criteria
* 1. Statement coverage
* 2. Branch coverage
*/
void
get_c_file_name (char *... |
C | #include<stdio.h>
#include<stdbool.h>
int reverseDigits(int num)
{
bool negativeFlag = false;
if(num<0)
{
negativeFlag = true;
num = -num;
}
static int rev_num = 0;
if(num>0)
{
rev_num = (rev_num*10)+ num%10;
reverseDigits(num/10);
}
return negativeFl... |
C | //this starts @ end of else in sheet he gave us today
fscanf(fin,"%d",&num); //prime read.
while(!feof(fin)){
count++;
fscanf(fin,"%d",&num);
}
if (count == 0){
perror("this to say");
exit(-1);
}
fseek(fin, 0, SEEK_SET);
//or
rewind(fin);
array=(int *) malloc(count * sizeof(int));
array=(int *)calloc(count, size... |
C | /*
Name: Ricerca di un elemento in vettore
Author: Alessandro Condello
Date: 01/10/19 08:54
Description: Si scriva una funzione in C, denominata cerca, che ricerchi la presenza di un elemento in un
vettore di interi. Il vettore e il valore x da cercare sono varabili globali
La funzione deve restitui... |
C | #include "kernel.h"
TKVPageDirectory vmmCreateDirectory() {
int i;
TKVPageDirectory directory = (TKVPageDirectory)allocPage();
for (i = 0; i < 1024; i++) {
directory[i] = 0;
}
return directory;
}
TKVPageTable vmmGetOrCreatePageTable(TKVPageDirectory directory, unsigned int prefix, int use... |
C | #include "types.h"
#include "bstrlib.h"
#include "ApplicationModel.h"
static simpleEvent applicationStartsEvent = 0;
void ApplicationModel_WhenApplicationStarts(void(*callback)(void)) {
applicationStartsEvent = callback;
}
int ApplicationModel_Run() {
applicationStartsEvent();
return 0;
}
int ApplicationModel_... |
C | #ifndef __RAMP_CNTL_CLA_H__
#define __RAMP_CNTL_CLA_H__
typedef struct { float TargetValue; // Input: Target input
int RampDelayMax; // Parameter: Maximum delay rate
float RampLowLimit; // Parameter: Minimum limit
float RampHighLimit; // Parameter: Maximum limit
int RampDelayCoun... |
C | /*
* Motor.c
*
* Created on: Jun 15, 2020
* Author: LeoTheLegion
*/
#include "Motor.h"
void setupMotor(){
pinMode(ENABLE, OUTPUT);
pinMode(CONTROL1, OUTPUT);
pinMode(CONTROL2, OUTPUT);
}
/*
* percentage = (0-1)
*/
void forward(float percentage){
setPowerto(percentage);
digitalWrite(... |
C | // ŽŰ (search key)
// ִ Ű(key)
// Ž Ͽ Ǵ ڷ
// 迭, ḮƮ, Ʈ,
// Ž: ڷ ϴ ãƳ
// Ž (Sequential search)
// Ž ߿ ϰ Ž
// ĵ 迭 ó ϳ ˻ϴ
// Ƚ
// Ž: (n+1)/2
// Ž: n
// ð: O(n)
int seq_search(int key, int low, int high) {
int i;
for (i = low; i <= high; i++)
if (list[i] == key)
return i; // Ž
return -1... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include "setting_datastructure.h"
extern devicelist* arrayofdevice; //定义写在.c当中,声明写在.h当中
task_node* alloc_node(char *t,char *fr,char* hn,int ts,char*fs,int fdm)
{
task_node* plinkNode=NULL;
plinkNode = (task_node *)malloc(sizeof(task_node));
plinkNode->type=t;
plinkNode->filterRules=fr;
plinkNode->hostna... |
C | #ifndef HAVE_ORDER_LINK_LIST_H
#define HAVE_ORDER_LINK_LIST_H
#include "common.h"
typedef struct _order_link_list_node_st {
void * data;
struct _order_link_list_node_st * next;
}OrderLinkListNode, * OrderLinkListNodePtr;
typedef int(*OrderLinkList_FucPtr_compare)(void* v1, void * v2);
typedef void(*OrderLinkList_F... |
C | #include <stdio.h>
#include <stdlib.h>
struct node
{
int info;
struct node *link;
};
struct node *removeValue(struct node *, int);
int main()
{
int n;
scanf("%d", &n);
struct node *head = (struct node *)malloc(sizeof(struct node));
head->link = NULL;
struct node *temp;
for (int i = 0;... |
C | /*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
C | /***
*** Decide whether this program terminates
*** If it does, use a model checker to verify a ranking function.
*** If it does not, use a model checker to find a non-terminating execution.
***
***/
/** Returns a non-deterministic value */
extern int nd(void);
int main()
{
int x = nd();
while (x <= 10)
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init_file_for_visu.c :+: :+: :+: ... |
C | #include "cmd_exec.h"
#include <assert.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <pwd.h>
#include <fcntl.h>
#include <dirent.h>
#include "psplit.h"
#include "sign_mgmt.h"
/******************************************************************************
* Funciones... |
C | #include "head.h"
#include "kernel_list.h"
//定义结构体
struct flight_information{
char number[15];
char begin[20];
char end[20];
char day[30];
char type[5];
char time[20];
int price;
struct list_head list;
};
//定义用户的结构体
struct user_information{
char user_account[20];
char user_mima[20];
char user_name[10];
... |
C | #include "header.h"
#include <stdio.h>
int main(int argc, char const *argv[])
{
int x,y, i ,j;
printf("Input x and y\n");
scanf("%d%d", &x, &y);
i = addition(x, y);
j = substraction(x, y);
printf("%d\n", i);
printf("%d\n", j);
return 0;
}
|
C | //
// scope.c
// Heck
//
// Created by Mashpoe on 7/6/19.
//
#include <scope.h>
#include <function.h>
#include <code_impl.h>
#include <class.h>
#include <print.h>
#include <stdio.h>
#include "vec.h"
heck_name* name_create(heck_code* c, heck_scope* parent, heck_idf_type type) {
heck_name* name = malloc(sizeof(heck... |
C | #include <stdio.h>
int main (void) {
static int a = 2, b = 4, c = 8;
static int *arr1[2] = {&a, &b};
static int *arr2[2] = {&b, &c};
int * (*arr[2]) [2] = {&arr1, &arr2};
printf("%d %d\n", *(*arr[0])[1], *(*(**(arr+1)+1)));
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *f;
f = fopen("a.txt", "w+");
for (int i = 10; i <= 100; i += 10)
{
fprintf(f, "%d\n", i);
}
fclose(f);
} |
C | /*Faça uma função que inverta dois valores passados como parâmetros para a função.
Mostre os valores invertidos antes e após a chamada da função
Você deve passar os valores por referência*/
#include<stdio.h>
#include<stdlib.h>
invert(int *pa,int *pb){
int aux = *pa;
*pa=*pb;
*pb=aux;
}
int main ()
{
int a,b;
... |
C | /*
1742 ϴ Ϸ ߴ.
4 ū ¦ Ȧ Ҽ Ÿ ִ
,
8 = 3 + 5. Both 3 and 5 are odd prime numbers.
20 = 3 + 17 = 7 + 13.
42 = 5 + 37 = 11 + 31 = 13 + 29 = 19 + 23.
´ ƴ ʾ ݷʵ ã ߴ.
ؾ 鸸 ̸ ¦ ־ Ȧ Ҽ ǥ ִ ˾ƺ ̴.
Է
6 ̻ 1000000 ̸ ¦ n Է ־.
Ҽ a , b ǥõ n = a + b Ѵ. "Goldbach's conjecture is wrong." ǥѴ.
... |
C |
// BUBBLE SORT
#include <iostream>
using namespace std;
int main()
{
int i,t,temp,flag,a[100];
cout<<"Enter the number of elements in the array :";
cin>>t;
cout<<"Enter the elements:"<<endl;
for(i=0;i<t;i++)
{
cin>>a[i];
}
//IMPLEMENTING BUBBLE SORT
... |
C | #include<stdio.h>
#define POWER 12.34
int main()
{
//int a=POWER;
printf("%d\n",POWER);
//printf("a=%d",a);
//printf("%s\n",POWER);
//printf("%f\n",POWER);
printf("%.1lf",POWER);
return 1;
} |
C |
//* Problem: 1097 (Sequence IJ 3)
#include <stdio.h>
int main(void)
{
int i, j;
for (i = 1; i <= 9; i += 2)
{
for (j = 0; j < 3; j--)
{
printf("I=%d J=%d\n", i, j);
j += 2;
}
}
return 0;
}
//or
#include <stdio.h>
int main(voi... |
C | #include "directory.h"
#include "constants.h"
#include "types.h"
#include "fat.h"
#include "macros.h"
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
DirectoryEntry deserialize_directory_entry(
const unsigned char* serialized_directory_entry
) {
const unsigned char fat_entry_buffer[3]... |
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 | #include<stdio.h>
#define max 50
void insert_sort(int a[],int n)
{
int i,j,k;
for(i=1;i<n;i++)
{
for(j=i-1;j>=0;j--)
if(a[j]<a[i])
break;
if(j!=i-1)
{
int temp=a[i];
for(k=i-1;k>j;k--)
a[k+1]=a[k];
... |
C | /*
Написать программу для перевод символов в верхний регистр.
Входные данные:
Одни символ в нижнем регистре.
Выходные данные:
Тот же самый символ, но в верхнем регистре.
Подсказки:
Обратите внимание на расстояние в таблице ASCII между одинаковыми буквами в разных регистрах. Например, между a и A, или h и H.
Samp... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include "encrypt.h"
/*Function to establish connection with server and transfer data */
int transferfunct... |
C | /*
** EPITECH PROJECT, 2018
** lemIPC
** File description:
** commander.c
*/
#include <stdio.h>
#include <memory.h>
#include <zconf.h>
#include "../../include/lemipc.h"
static int count_players(commander_t *cmd)
{
int count = 0;
size_t h = cmd->mem->height;
size_t w = cmd->mem->width;
for (size_t i = 0 ; i < h *... |
C | /*
-- run
-- gcc file.c -o outfile -lm (why using lm when using ceil function.)
The median of an array of numbers is the element m of the array such that half the remaining
numbers in the array are greater then or equal to m and half are less than or equal to m,
if the number of elements in the array is odd. i... |
C | int main(){
int n,i,j=0,a[100],b[100],s=0,c[100]={0},e;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d",&a[i],&b[i]);
if(a[i]>=90&&a[i]<=140&&b[i]>=60&&b[i]<=90&&i!=n-1){
s++;
}
else if(a[i]>=90&&a[i]<=140&&b[i]>=60&&b[i]<=90&&i==n-1){
s++;
c[j]=s;
}
else{
c[j]=s;
s=0;
j+... |
C | // Name: Olga Rudina
// Student Number:
// Section:J
// Workshop:4
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define MAXDAYS 10
// Put your code below:
int main(void)
{
int i;
int dayNum;
int high[MAXDAYS], low[MAXDAYS];
int theHighest = 0;
int theLowest = 0;
int dayHigh;
int... |
C | /* program cast01.c */
/* demotype casting */
main()
{
int i = 10;
float f = 1.234;
printf("%f\n",(float)i/3);
printf("%lf\n",(double)f);
}
|
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <mpi.h>
/*
@author: Aldo Tali
@creds: Senior Computer Engineering Student, Bilkent Uniersity
@ID: 21500097
@Course: Parallel Computing - CS426
@Project01: Spring 2019 - Due 10/03/2019
@Section: Part B2
@Des... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "game.h"
#define assert(condition) ((condition) ? (true) : \
(fprintf(stderr, "Assertion failed! Check test.c.\nLine number: %d: %s\n", __LINE__, #condition), \
abort()))
DecisionTreeNode* flattenTree(DecisionTreeNode* root)... |
C | #include <stdio.h>
#include <openssl/bn.h>
void printBN(char * msg, BIGNUM * a){// changes were made here for printing style
char * number_str = BN_bn2hex(a);
printf("%s%s", msg , number_str);
OPENSSL_free(number_str);
}
int main(){
BN_CTX * ctx = BN_CTX_new();
BIGNUM *n = BN_new();
BIGNUM *d = BN_new();
BIG... |
C | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// File name: main.c
// Author: Jan K. Schiermer
// Created on: 22 Nov 2018
// Description:
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include <stdio.h>
int menu(void);
void show_soduko(void);
v... |
C | #pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Array(T) \
struct Array { \
T *contents; \
uint32_t size; \
ui... |
C | /*************************************************************************
> File Name: Linklist.h
> Author: kwh
> Mail:
> Created Time: 2019年07月13日 星期六 21时13分41秒
************************************************************************/
#ifndef _LINKLIST_H
#define _LINKLIST_H
#endif
#include <stdlib.h>
#includ... |
C | #include<stdio.h>
int main(){
int k=0, i=0, j=0, tamanho[100000], qtd=0;
char lado[100000];
while( scanf("%d %c", &tamanho[i], &lado[i])!= EOF){
k++;
i++;
}
for(i = 0; i < k; i++){
scanf("%d %c", &tamanho[i], &lado[i]);
}
for(i = 0; i< k; i++){
for(j = 0;... |
C | /* ARRAY IMPLMENTATION OF QUEUE */
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "queue.h"
#define MAX_QUEUE_SIZE 100
size_t top, bot, size;
Item array[MAX_QUEUE_SIZE];
void make_empty(){
top = 0;
bot = 0;
size = 0;
}
bool is_empty() {
if (size == 0) {
return true;
... |
C | /* linkedlist.c */
#include "linkedlist.h"
void insertFirst(struct linkedList * head, int ele){
//create a node
struct node *link = (struct node*) malloc (sizeof(struct node)); /* by this
you are creating a node whose address is being stored in the link pointer. */
link->element = ele;
//point it to old first node
... |
C | #include <stdio.h>
int main(void) {
int a, n, soma = 0, i = 0;
scanf("%d %d", &a, &n);
if(n <= 0)
while(n <= 0)
scanf("%d", &n);
while(n-- > 0) {
soma = soma + (a+i);
i++;
}
printf("%d\n",soma);
return 0;
} |
C | /*
* SHT20.c
*
* Created on: Jul 31, 2016
* Author: matt
*/
#include "SHT20.h"
void sht20_init()
{
}
uint16_t sht20_get_raw_temp()
{
uint16_t temp;
uint8_t crc;
twi_read_word_crc(SHT20_ADDRESS, TEMP_HOLD, &temp, &crc);
return temp & VALUE_STATUS_MASK;
}
double sht20_get_temp()
{
return (double)sht... |
C | #include<stdio.h>
int main()
{
enum status {pass, fail, atkt};
enum status stud1, stud2, stud3;
stud1 = pass;
stud2 = fail;
stud3 = atkt;
printf("%d %d %d",stud1, stud2,stud3);
return 0;
}
|
C | #include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "setjmp.h"
#include "signal.h"
jmp_buf jmpSigSev;
struct sigaction sigActionSegv;
void sigSegvHandlerWithJmp(int signal, siginfo_t *si, void *arg) {
printf("Caught segfault at address %p\n", si->si_addr);
printf("regain control thanks to longjmp\... |
C | /*
Dalam pointer simbol * merujuk pada value
Dalam pointer simbol & merujuk pada alamat
*/
#include <stdio.h>
int main(){
int a = 10, b = 20, c;
int *pa, *pb;
pa = &a, pb = &b;
*pa = 15; // Value pada alamat yang ditampung pa (a) akan diubah menjadi 15
c = *pa + *pb; // c diisi dengan penju... |
C | /*
Copyright (c) 2011-2012 Hiroshi Tsubokawa
See LICENSE and README
*/
#include "ObjectGroup.h"
#include "VolumeAccelerator.h"
#include "ObjectInstance.h"
#include "PrimitiveSet.h"
#include "Accelerator.h"
#include "Interval.h"
#include "Matrix.h"
#include "Array.h"
#include "Ray.h"
#include "Box.h"
#include <stdlib.... |
C | /* { dg-do run } */
/* { dg-options "-O2 -fdump-tree-strlen" } */
#include "strlenopt.h"
char temp[30];
volatile int v;
size_t __attribute__ ((noinline, noclone))
f1 (void)
{
char a[30];
v += 1;
memcpy (a, "1234567", 7);
memcpy (a + 7, "89abcdefg", 9);
memcpy (a + 16, "h", 2);
return strlen (a); // This ... |
C | #include <stdio.h>
int chercherMin(int *tableau, int taille)
{
int i;
int min;
for (i = 0; i < taille; i++)
{
if (tableau[i] < tableau[min])
min = i;
}
return min;
}
int main()
{
int nbAutos;
int listDepart[1001];
int i, j;
int min;
scanf("%d", &nbAutos);
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<sys/shm.h> // shared memory
#include<sys/sem.h> // semaphore
#include<sys/msg.h> // message queue
#include<string.h> // memcpy
#include "msg.h"
int create_msg(void)
{
key_t key;
int msqid;
// 获取key值
if((key = ftok(".", 'z')) < 0)
{
... |
C | #include<stdio.h>
void main()
{int n,space,row,i,j;
scanf("%d",&n);
space=n-1;
for(row=1;row<=n;row++)
{for(i=1;i<=space;i++)
{printf(" ");}
space--;
for(j=1;j<=2*row-1;j++)
{printf("*");}
printf("\n");}
}
|
C | /*
* @Author: cy101
* @Date: 2020-03-09 22:09:06
* @Last Modified by: cyang
* @Last Modified time: 2020-03-09 23:01:38
*/
#include <stdio.h>
int maxProfit(int* prices, int pricesSize){
int sum = 0;
for (int i = 0; i < pricesSize-1; ++i)
{
if (prices[i+1] > prices[i])
{
sum += prices[i+1]... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* verify_keys.c :+: :+: :+: ... |
C | void acreate()
{
printf("\nEnter the size of the array elements:\t");
scanf("%d",&n);
printf("\nEnter the elements for the array:\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
}//end of create()
void adisplay() //displaying an array elements
{
int ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char shellcode[] = "\xeb\xfe";
int main(int argc, char *argv[]){
void (*f)();
char x[4];
memcpy(x, shellcode, sizeof(shellcode));
f = (void (*)()) x;
f();
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
void strToInts(char *ipAdd, int* iArr )//ipַתͣ洢iArr
{
char temp[4] = {0};
char *p = ipAdd;
int i =0;
int j= 0;
while (*p != '\0')//ǰ'.'ַָת
{
if (*p != '.')
{
temp [j] = *p;
j++;
++p;
}
else
{
iArr[i] = atoi(temp);
memset(temp,0,sizeof(temp));
j = 0;... |
C | #include "types.h"
////////////////////////////////////////////////////////////////////////////////
//!
//! \brief compare two char arrays
//!
//! \param aStr1 - pointer data array of chars
//! \param aStr2 - pointer data array of chars
//!
//! \return TRUE if arrays are equals
//! FALSE if arrays ... |
C | /*
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
*/
/******************************************************************************
* @file csi_kernel.h
* @brief header file for kernel definition
* @version V1.0
* @date 02. June 2017
*******************************************************... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int number,sum=0,count=1;
do
{
printf("Enter a number : \n");
scanf("%d",&number);
sum=sum+number;
count++;
}while(count<=5);
printf("Print the result : %d \n",sum);
getch();
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char *argv[])
{
char s[] = " hello|world|do|you|work";
char *sep = "|";
char *p;
// printf("%s\n",strtok(s,sep));
strtok(s,sep);
while((p = strtok(NULL,sep)))
{
printf("%s\n",p);
}
return 0;
}
|
C | /*
* main.c
*
* Created on: 09/05/2013
* Author: masc
*/
#include <stdio.h>
int main(void) {
char c = 'D';
while (c < 'L') {
if (!(c % 2))
c++;
else
c += 5;
printf("%c", c);
}
return 0;
}
|
C | /*****************************************************************************
* Copyright (C) Krutika Sanjay Anasane anasaneks15.it@coep.ac.in
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software ... |
C | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../struct.h"
extern s_global *g_global;
void init_history(void)
{
char *home = getenv("HOME");
char *buf = malloc(sizeof (char) * (strlen(home) + 15));
strcpy(buf, home);
strcat(buf, "/.42sh_history");
g_globa... |
C | // COA-602 Tarea 9 Ejercicio 3
// Fecha de creacion: 10-Marzo-2020
/*********************************************************************************************************************************
Lea una lista de salarios entre 5000 y 20000 de tamaño n < 30.
Luego, clasifique la lista en tres estratos. 5000-10000, 1... |
C | #include <stdio.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
////////////////////////////////////////////////////////////////////////////////////////////////
// The following is a heap/priority queue -> https://en.wikipedia.org/wiki/Heap_(data_structure)
// implementation where the data sto... |
C | #include "GL\glut.h"
#include <math.h>
GLdouble dvect[] = {0.25, 0.5, 0.0};
GLint circle_points = 100;
const float PI=3.1415926;
GLfloat xangle = 0;
void vertexRender()
{
static GLfloat data[] = {
5, 5, 5, 1, 0, 1,
5, 5, -5, 0, 1, 1,
-5, 5, -5, 1, 1, 1,
-5, 5, 5, 1, 0, 1,
5, -5, 5, 0, 1, 1,
-5,... |
C | #include "holberton.h"
/**
* create_file - Create a file
* @filename: file name
* @text_content: content of file
* Return: 1 or -1
*/
int create_file(const char *filename, char *text_content)
{
int fd, i = 0, w;
if (filename == NULL)
return (-1);
fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0600);
if... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "parse.h"
/* filearg - for reading a list of things, either from a string (i.e.,
* command-line argument) or from a file. Returns a semicolon-separated
* list.
* Its arguments are:
*... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "automata.h"
#include "parametros.h"
int main(int argc, char** argv) {
struct parametros_t parametros;
unsigned int cant_celdas;
unsigned char regla;
char* nombre_arch_entrada;
char* nombre_arch_salida;
FILE* archivo_entrada;
FILE* archivo_sal... |
C | /*
* Delta programming language
*/
#include "delta/delta.h"
#include <math.h>
/**
* @category modules/core/math
*
* @brief Find lowest value.
* @syntax number min ( array values )
* @syntax number min ( number value1 , number value2 [, number value3... ] )
*
* If the first and only parameter is an array, ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: ... |
C | /*
* Tema 2 ASC
* 2018 Spring
* Catalin Olaru / Vlad Spoiala
*/
#include "utils.h"
/*
* Add your unoptimized implementation here
*/
double* my_solver(int N, double *A) {
printf("NEOPT SOLVER\n");
double *C = calloc(2 * N * N, sizeof(double));
int i, j, k;
for (i = 0; i < N; i++) {
for (j = i; j < N; j++) ... |
C | #include <stdlib.h>
#include "CUnit/CUnit.h"
#include "CUnit/Basic.h"
#include "student_code.h"
int init_suite(void) {return 0;}
int clean_suite(void) {return 0;}
void get_bit_test(void){
unsigned int a = 59;
CU_ASSERT_EQUAL(get_bit(a, 0), '1');
CU_ASSERT_EQUAL(get_bit(a, 7), '0');
}
void set_bit_test(void){
u... |
C | /*******************************
getch()
Reproduce effect of getch() function
on Linux.
Entering Parameters: none
Returned value: none
*******************************/
int getch(void)
{
struct termios oldt, newt;
int ch;
tcgetattr(STDIN_FILENO, &oldt);
newt = oldt;
newt.c_lflag &= ~( ICANON | ECHO);
tcsetattr( ... |
C | /*
Вариант 9
Фамилия спортсмена
Вид спорта
Количество медалей
Расположить в алфавитном порядке записи с ненулевым количеством медалей
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct athlet {
char surname[50];
char sport[50];
int countMedals;
};
int main(int argc, char **argv) {
i... |
C | #include <pwd.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "shell_fct.h"
//sudo apt-get install libreadline-dev
int main(int argc, char** argv)
{
int ret = MYSHELL_CMD_OK;
char* readline... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
}*head=NULL;
struct node *current=NULL;
// Creating a linked List in C
//Use a function called create to create a list
void create()
{
struct node *newnode, *current;
newnode=(struct node*)malloc(sizeof(stru... |
C | // Converts a person's full name into initials.
// Usage: ./initials
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
void to_initials();
int main(void)
{
printf("What is your full name?\n");
string name = get_string();
to_initials(name);
}
void to_initials(string s)
{
in... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_inputrc.c :+: :+: :+: ... |
C | /*
Based on PSFEx.h by peter melchior
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "psfex.h"
#include "poly.h"
static const double INTERPFAC = 4.0;
static const double IINTERPFAC = 0.25;
struct psfex *psfex_new(long *masksize, // [MASK_DIM]
long poldeg,
double *con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.