language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | //
// zadanie4.h
// lista4
//
// Created by Jan Śnieg on 03/04/2018.
// Copyright © 2018 Jan Śnieg. All rights reserved.
//
#ifndef zadanie4_h
#define zadanie4_h
int partition (int n, double t[])
{
int k = -1;
// int ile = n;
double x = t[n / 2];
while (true)
{
while (t[--n] > x);
... |
C | /* Sieve of eratosthenes */
#include <mpi.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
//#include "MyMPI.h"
#define MIN(a,b) ((a)<(b)?(a):(b))
#define OFFSET 3
#define SEED_SIZE(n) (int)ceil((((double)sqrt(n))/2))
#define SEED_OFFSET(n) ((SEED_SIZE(n)*2) + OFFSET)
#define SEED_HIGH(n) (SEED_OF... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_file.c :+: :+: :+: ... |
C | /*
* ISEL - DEETC - LEIC
* Programação em Sistemas Computacionais
* João Trindade
*
* Point: versão C da classe Point
*/
#include "Point.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static const PointMethods Point_vtable = {
"Point",
sizeof(Point),
Point_magnitude,
Point... |
C | /**
* \file appl_generic_location_client.c
*
* \brief This file defines the Mesh Generic Location Model Application Interface
* - includes Data Structures and Methods for Client.
*/
/*
* Copyright (C) 2018. Mindtree Ltd.
* All rights reserved.
*/
/* --------------------------------------------- Header File ... |
C | #include<stdio.h>
#include<stdlib.h>
int main(void)
{
int ch;
int len = 0;
while( ( ch = getchar() ) != EOF )
{
if( ch =='{' )
len++;
else if( ch == '}' )
{
/* 如果此时len==0 说明此时都没有左花括号,因此肯定是错误的匹配 */
if(len == 0)
printf("Extra closing brace!\n");
else
len--;
}
}
if(len == 0)
printf ( ... |
C | #include <stdlib.h>
#include <stdio.h>
int sum(int *array, int n) {
int sum = 0;
for (int i = 0; i < n; i++) {
sum += array[i];
}
return sum;
}
int main(void) {
int *buffer = calloc(sizeof(int), 10);
buffer[0] = 10;
printf("before = %d\n", sum(buffer, 10));
buffer = realloc(buf... |
C | #define _GNU_SOURCE
#include <stdio.h>
#include <time.h>
#include <stdint.h>
#include <stdlib.h>
#include <pthread.h>
#include <assert.h>
#include <sched.h>
#include <string.h>
#define CLOCK_TYPE CLOCK_MONOTONIC_RAW
uint64_t getclock()
{
struct timespec ts;
if (clock_gettime(CLOCK_TYPE, &ts) != 0) {
perror("clock... |
C | #include<stdio.h>
int main()
{
int n,reverse=0;
printf("Please enter a number for palindrome check\n");
scanf("%d",&n);
int t=n;
while(t)
{
reverse=reverse*10+(t%10);
t/=10;
}
if(n==reverse)
printf("%d is a Palindrome",n);
else
printf("%d is not a Palind... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node* link;
};
struct node* head;
void insertatpos(int data,int pos)
{
int i;
struct node* temp=(struct node*)malloc(sizeof(struct node));
temp->data=data;
if(pos==1)
{
temp->link=head;
head=temp;
return;
}
struct node... |
C | #include <stdio.h>
#include <unistd.h>
main(){
int i;
for(i=0;i<1030;i++)
printf("A");
sleep(3);
printf("BBB");
}
|
C | #include"SeqQueue.h"
#define _CTR_SECURE_NO_WARNINGS
typedef struct PERSON
{
char name[64];
int age;
}Person;
int main()
{
SeqQueue* queue = Init_SeqQueue();
printf("%d", queue->size);
Person p1 = { "aaa",10 };
Person p2 = { "bbb",20 };
Person p3 = { "ccc",30 };
Person p4 = { "ddd",40 };
Person p5 = { "eee",... |
C | #include<stdio.h>
typedef struct log
{
char in_out;
int r;
}log;
int main()
{
int n,i,j;
scanf("%d",&n);
log a[n];
int ans[1000001];
for(i=0;i<1000001;i++)
ans[i]=-1;
int c=0;
int flag1=0;
for(i=0;i<n;i++)
{
int flag=0;
scanf("%c",&a[i].in_out);
... |
C | #include <stdio.h>
#include <stdlib.h>
int n,k;
int a[5][5];
int sol(int x, int y,int num){
//printf("%d %d %d\n",x,y,num);
int ans=a[x][y]^num;
if(x==n-1){
if(ans==0){
return 1;
}
return 0;
}
int i;
for(i=0;i<k;i++){
if(sol(x+1,i,ans))r... |
C |
/*
* Copyright (C) xianliang.li
*/
#include <string.h>
#include <stdlib.h>
#include "lxl_rbtree.h"
static inline void lxl_rbtree_left_rotate(lxl_rbtree_node_t **root, lxl_rbtree_node_t *sentinel, lxl_rbtree_node_t *node);
static inline void lxl_rbtree_right_rotate(lxl_rbtree_node_t **root, lxl_rbtree_node_t *se... |
C | #include <iostream>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
typedef long long LL;
const int MOD = 1000000007;
LL pow(LL a, int p) {
if(p==0) return 1;
if(p==1) return a;
LL ret = pow(a,p>>1);
(ret *= ret)%=MOD;
if(p&1) (ret *= a)%=MOD;
return ret;
}
int main()
{
int N; ci... |
C | #include<stdio.h>
int main() {
float unit;
printf("Units : ");
scanf("%f", &unit);
if(unit >= 0) {
if(unit <= 50) {
printf("Bill : Rs %f", unit * 0.50);
} else if(unit > 50 && unit <= 100) {
printf("Bill : Rs %f", unit * 0.75);
} else if(unit > 100 && unit <= 250) {
printf("Bill : Rs %f", unit * 1.... |
C | #include <stdlib.h>
#include <string.h>
#include <kogata/mainloop.h>
mainloop_fd_t *mainloop_fds = 0;
bool mainloop_fds_change = false;
bool mainloop_must_exit = false;
void mainloop_add_fd(mainloop_fd_t* fd) {
mainloop_fds_change = true;
fd->next = mainloop_fds;
mainloop_fds = fd;
fd->rd_buf_filled = 0;
}
vo... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
FILE *output;
FILE *answer;
char command[100];
char buf[100];
char output_str[100];
char answer_str[100];
printf("initialize output? (y/n)\n");
scanf("%c", &(command[0]));
if(command[0] == 'y'){
system("ja... |
C | #include "stm32f4xx.h"
#include "sys.h"
#include <stdio.h>
#include "MFRC522.h"
//GPIOʼĽṹ
static GPIO_InitTypeDef GPIO_InitStructure;
static USART_InitTypeDef USART_InitStructure;
static NVIC_InitTypeDef NVIC_InitStructure;
struct __FILE { int handle; /* Add whatever you need here */ };
FILE ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* checker.c :+: :+: :+: ... |
C |
/*
* bitarraytest.c
* testing the bit array implementation
*
* @author Steve Hoffmann
* @email steve@bioinf.uni-leipzig.de
* @date 07/15/2007 02:12:32 AM CEST
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "basic-types.h"
#include "memory.h"
#include "bitArray.h"
int
main(int... |
C | #include <stdio.h>
#include "arraypermutations_Permutations.h"
void permute(int *a, int size, int n){
if (size==1) {
//int number = sizeof(a)/sizeof(a[0]);
for (int i=0; i<n; i++) {
printf("%d ", a[i]);
}
printf("\n");
}
else{
for (int i=0; i<size; i++) {
permute(a, size-1, n);
if... |
C | /*
Environment Variables via Context.
*/
TK_EnvContext *tk_envctx_free;
TK_EnvContext *TK_EnvCtx_AllocContext(void)
{
TK_EnvContext *tmp;
tmp=tk_envctx_free;
if(tmp)
{
tk_envctx_free=tmp->next;
memset(tmp, 0, sizeof(TK_EnvContext));
return(tmp);
}
tmp=tk_malloc(sizeof(TK_EnvContext));
memset(tmp, 0,... |
C | /*estrategia de solucao
fazer uma função de busca em largura
em que se armazene 3 tempos minimos para chegar
na casa, um quando t %3 =0, t%3=1, t%3=2
Nessa busca em largura as arestas são dependentes do tempo (variavel t), podendo estar "abertas" ou "fechadas".
Após chegar na rotatória final, a busca em profundidade ... |
C | #include <stdio.h>
#include <conio.h>
#include <math.h>
//Global vars
int matrix1[25][25], matrix2[25][25], result[25][25];
int r1, c1, r2, c2, i, j, k; //throughout the program i and j are variables reserved for use in for loops
int initSetup()
{
printf("Enter the no. of rows in the first matrix and press the retur... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | //
// Created by Kushagra Kandpal on 03-07-2021.
//
/*
* Link to Problem : https://binarysearch.com/problems/Swap-Kth-Node-Values
*/
#ifndef DS_LLSWAPNODE_MED_H
#define DS_LLSWAPNODE_MED_H
#endif //DS_LLSWAPNODE_MED_H
#include "../DSAImplementation/linkedlists.h"
LLNode* solve(LLNode* node, int k) {
int size ... |
C | /**
* MPTCP Socket API Test App
* File Sender with Subflows Info (Client)
*
* @date : 2021-05-25(Thu)
* @author : Ji-Hun(INSLAB)
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#incl... |
C | #ifndef _createTensor_h____
#define _createTensor_h____
// The function "createTensor" helps in allocating spaces to tensors in mempool.
// It starts with storing the "TensorDescriptor" in the mempool followed an empty
// space in mempool required to fill in the tensor.
void fillTensorDescriptor(Tensor *t);
//This me... |
C | #include "mesh_bridge_utils.h"
/* INCLUDES */
// C STANDARD
#include <stdint.h> // uint16_t
// NRF
#include "boards.h" // bsp_board_led_off, bsp_board_led_on
// LUOS
#include "luos_utils.h" // LUOS_ASSERT
#include "routing_table.h" // rout... |
C |
#include "json.h"
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
static JSON_VALUE*
json_alloc_value(JSON_TYPE type)
{
JSON_VALUE* v = (JSON_VALUE*) malloc(sizeof(JSON_VALUE));
memset(v, 0, sizeof(JSON_VALUE));
v->type = type;
return v;
}
typedef struct JSON_BUFFER {
char* buf;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_digit.c :+: :+: :+: ... |
C | /* Doubly-linked list macros */
#ifndef _Iqueue
#define _Iqueue 1
#include "config.h"
/* Use this as first member of a structure to make it into a doubly linked
* list node.
*/
#define QITEM(type) type *next, *prev
/* Use this to make the base node of a doubly-linked list. Or if the item
* making up the structu... |
C | /**************************************************************************
* Author : RebelIce 杨俊逸
* Email : yangrebelice@gmail.com
* Github : github.com/rebelice
* ************************************************************************/
#define _GNU_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <std... |
C | #include "libft.h"
void *ft_memccpy(void *dst, const char *src, int c, size_t n)
{
size_t i;
unsigned char *str1;
unsigned char *str2;
unsigned char k;
k = (unsigned char)c;
i = 0;
str1 = (unsigned char *)src;
str2 = (unsigned char *)dst;
while (i < n)
{
str2[i] = str1[i];
if (str2[i] == k)
{
ret... |
C | /*
5.4-C-11th-1:
结构体占用空间、结构体各成员变量对齐方式
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#pragma pack
//结构体成员对齐方式会影响到结构体的大小
//结构体成员都是以偶数字节开始存储,但是连续多个字符串会挨着存储
struct a_t{
char ch;
short s;
int i;
};
int main(void)
{
struct a_t a;
//&a.ch | &a.s
printf("sizeof(a) = %d\n", sizeof(a)); //打印结构体占用空间... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test_strncpy.c :+: :+: :+: ... |
C | #include <stdio.h>
void createArrayPointer(int *pointer) {
for(int zeile = 0; zeile < 8; zeile++) {
for(int spalte = 0; spalte < 8; spalte++) {
*pointer++ = (zeile+1) * 10 + spalte+1;
}
}
}
void showArray(int array[8][8]) {
for(int zeile = 0; zeile < 8; zeile++) {
for(i... |
C | //
// main.c
// Lista(enDisco)
//
// Created by Victorio Scafati on 8/24/17.
// Copyright © 2017 Victorio Scafati. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "tree.h"
#include "abm.h"
/*
TO-DO list:
SOLVED - Agregar inOrden
SO... |
C | #include <stdio.h>
#include <stdlib.h>
/* Faca um programa para ler um numero intiero positivo de tres digitos. Em seguida, calcule e mostre o numero formado pelos digitos invertidos do numero lido. */
int main() {
int numero, numero_invertido1, numero_invertido2, numero_invertido3;
printf("Digite um numero ... |
C | /*
============================================================================
Name : p284.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#in... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<malloc.h>
#include<math.h>
int mon[13];
int s,d;
int add(int i,int j){
int ans=0;
for(i=i;i<=j;i++){
if(mon[i]==1){
ans+=s;
}
else{
ans-=d;
}
}
return ans;
}
int main(){
int i,j;
... |
C | /*
* File: HW1.c
* Author: Tevin Taylor and Benjamin Valentino
*
* Created on February 8, 2017, 5:54 PM
*/
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <ctype.h>
#include <string.h>
int main(int argc, char** argv) {
//Variable declarations
char *user_dir = m... |
C | #include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
/**
RTLD_LAZY:在dlopen返回前,对于动态库中的未定义的符号不执行解析(只对函数引用有效,对于变量引用总是立即解析)。
RTLD_NOW: 需要在dlopen返回前,解析出所有未定义符号,如果解析不出来,在dlopen会返回NULL,错误为:: undefined symbol: xxxx.......
*/
int main() {
void *libmhandler = NULL;
float (*cosf_method)(float) = NULL;
int (... |
C | /* Expand the stack by 32 bytes all at once using the PUSHA
instruction.
This must succeed. */
#include <string.h>
#include "tests/arc4.h"
#include "tests/cksum.h"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
asm volatile
("movl %%esp, %%eax;" /* Save a copy of the stack p... |
C | #include <stdio.h>
void main(){
int num1, num2, suma;
printf("\nEste programa calcula la suma de dos numeros enteros.\n");
printf("\nIntroduce el valor del primer numero:\n");
scanf("%d",&num1);
printf("\nIntroduce el valor del segundo numero:\n");
scanf("%d",&num2);
suma = num1+n... |
C | #include <stdio.h>
int SomeOfElement(int A[], int size){
int sum=0;
for(int i=0; i<size;i++){
sum+=A[i];
}
return sum;
}
main(){
int A[]={2,3,4,5,6};
int size= sizeof(A)/sizeof(int);
//size= sizeof(A)/sizeof(A[0]);
int total=SomeOfElement(A,size);
printf("Some Of Element: %d"... |
C | // ±ȯ
#include <stdio.h>
int main(void)
{
int a = 33, b = 77;
int tmp;
puts("-----------------------");
puts(" * ±ȯ *");
puts("-----------------------");
printf(" a=%d, b=%d \n", a, b);
puts("-----------------------");
tmp = a;
a = b;
b = tmp;
printf("\n ȯ a=%d, b=%d \n", a, b);
puts("--------------... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "/lib/wizard.h"
void menu(){
int option=0;
do{
printf("\n------------------------------\n");
printf(" WIZARD\n\n");
printf("1. Jugar contra la máquina\n");
printf("2. Dos jugadores\n");
printf("3. Acerca del juego\n");
printf... |
C | /*
* 应用程序中打印call stack调用栈的方法
* 需要编译选项'-rdynamic'的支持
*/
#include <stdio.h>
#include <stdlib.h>
#include <execinfo.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h> /* open() */
#include <unistd.h> /* close() */
#include <string.h>
#include <errno.h> /* errno */
void dump_stack()
{
const size_t ... |
C | /* exploit.c */
/* A program that creates a file containing code for launching shell*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* fix the shell code */
char shellcode[]= "eh?";
unsigned long get_sp(void)
{
__asm__("movl %esp,%eax");
}
void main(int argc, char **argv)
{
char buffer[1000]... |
C | #include "tree.h"
//////////////////////////////////////////////////////////////////////
//
// addnode() - place newNode into indicated tree at proper position.
//
// status code: this function can generate the following status codes
// DLT_SUCCESS: normal operation (success!)
// ... |
C | #include <stdio.h>
#include <locale.h>
// CONVERSAO CELSIUS -> KELVIN
int main(){
int c;
scanf("%d", &c);
printf("%.2f", c + 273.15);
}
|
C |
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include<omp.h>
#include<time.h>
#define NUM_ITEMS 100000000
void mergeSort(int numbers[], int temp[], int array_size);
void m_sort(int numbers[], int temp[], int left, int right);
void merge(int numbers[], int temp[], int left, int mid, int right);
int nu... |
C | #include "GlobalDefine.h"
#include "Error.h"
#include "Stdio.h"
#include "Common.h"
#include "CommandManager.h"
typedef void(*ADDRESS)();
int do_go_exec(int(*entry)())
{
return entry();
}
/*******************************************************************
* Function Name: TestSn
* Inputs : ... |
C | #include <stdbool.h>
#include <stdio.h>
#include "uart_driver.h"
static int array_iterator = 0;
static bool is_enabled = false;
void uart_driver_start_communication() {
/** dummy function, don't care about the code inside */
is_enabled = true;
}
void uart_driver_stop_communication() {
/** dummy function... |
C | #include <fcntl.h>
#include <pthread.h>
#include <semaphore.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
const char *semaphore_name = "semaforo";
sem_t mutex;
int turn;
void gravaNumeros() {
... |
C | #include "unit_test.h"
int main(){
printf("\n[-------- Unit tests --------]\n");
int result = 0;
//run the tests for all the units
result += interpreter_test();
result += tokenizer_test();
if(result != 0){
printf("Unit testing: %d tests FAILED\n", result);
} else {
printf("Unit testing: All tests PASSED\n... |
C | // Value of the polynomial ver 2
#include <stdio.h>
int main(void)
{
int x,f;
printf("Enter the value of x: ");
scanf("%d",&x);
f=((((3*x+2)*x-5)*x-1)*x+7)*x-6;
printf("Value of the polynomial: %d\n",f);
return 0;
}
|
C | /* Originally this program just generated uudmap.h
However, when we later wanted to generate bitcount.h, it was easier to
refactor it and keep the same name, than either alternative - rename it,
or duplicate all of the Makefile logic for a second program. */
#include <stdio.h>
#include <stdlib.h>
/* If it tu... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <byteswap.h>
#include "misc.h"
uint64_t htolell(uint64_t hostlong) {
#if !defined(__BYTE_ORDER__) || !defined(__ORDER_BIG_ENDIAN__)
#error unable ... |
C | #include <assert.h>
#include <limits.h>
#ifndef __GNUC__
int __builtin_ffs(int);
int __builtin_ffsl(long);
int __builtin_ffsll(long long);
#endif
int __VERIFIER_nondet_int();
long __VERIFIER_nondet_long();
long long __VERIFIER_nondet_long_long();
// http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMul... |
C | //
// xcmd.c
// XCMD
//
// Created by Bismarrck on 6/29/14.
// Copyright (c) 2014 TCCL. All rights reserved.
//
#include <stdio.h>
#include "xcmd.h"
#include "global.h"
#include "fileio.h"
#include "velocity.h"
#include "motion.h"
#include "potential.h"
#include "force.h"
#include "utilities.h"
#include "unit.h"
... |
C | #include <stdio.h>
//#define SQUARE(X) X*X
// 비정상 계산을 막기 위해1
// #define SQUARE(X) (X)*(X)
// 비정상 계산을 막기 위해2
#define SQUARE(X) ((X)*(X))
/*
매크로 두줄이상 정의
#define SQUARE(X) \
((X)*(X))
*/
int main(void)
{
int num=20;
/* 정상적 결과 출력 */
printf("Square of num : %d \n", SQUARE(num));
prin... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** args)
{
if (argc != 3)
{
fprintf(stderr, "The number of arguments is not enough. \n");
exit(1);
}
if (strlen(args[1]) != strlen(args[2]))
{
fprintf(stderr, "The length of the two strings does NOT match. \n");
exit(1);
... |
C | #include <stdio.h>
void print_sample(char * str)
{
printf("%s\n",str);
print_sample("Done!");
}
int main()
{
for (int i=0; i<10; i++)
print_sample("printing...");
return 0;
}
|
C | #include <stdio.h>
#define MAXLEN 1000
#define TOSCREEN 80
int getline(FILE *f, char s[], int lim);
int main(int argc, char const *argv[])
{
FILE *myin, *myout;
myin=fopen("in.txt","r");
myout=fopen("out.txt","w");
int c;
char line[MAXLEN];
int len;
while((len=getline(myin,line,MAXLEN))>0)
if(len>TOSCREEN)... |
C |
#include "strbuf.h"
#include <stdlib.h>
#include <stdio.h>
strbuf * strbuf_init() {
strbuf * buf = (strbuf *) malloc(sizeof (strbuf));
buf->tail = NULL;
buf->head = NULL;
buf->direct_out = NULL;
return buf;
}
void strbuf_free(strbuf * buf) {
strbuf_node * cur, * t;
cur = buf->tail;
w... |
C | #pragma once
#include <stdbool.h>
#include <file_ops.h>
typedef struct AudioPlayerParam {
Entry *entries;
int n_entries;
int index;
const char *cwd;
bool play_all; // true -> play all songs in folder
} AudioPlayerParam;
/** Start the audio player at the file entry at index. */
int audio_player(Aud... |
C | #include <stdio.h>
#include <string.h>
char S[2][17]; // Направил съм го 17, а не 16 заради '\0'
char F(char x){
return S[0][x>>6] + S[1][x>>4];
}
void encrypt(char L, char R, char* out){
for(int i=0;i<16;i++){
R^=F(L);
L^=F(R);
}
out[0]=R;
out[1]=L;
}
void decrypt(char L, char R... |
C | #include <stdio.h>
/* Multiplication Table */
void main(void)
{
int iterator, num;
printf("Enter the number to display its multiplication table : ");
scanf("%d", &num);
printf("\n");
for (iterator = 1; iterator <= num; iterator++)
{
printf("%d X %d = %d \n", num, iterator... |
C | #include<stdio.h>
#include<string.h>
int main() {
char a[50];
printf("Enter word : "); gets(a);
int count;
for(int i=0; a[i]!='\0'; i++){
count=i;
if(a[i]=='a'){
while(a[count]!='\0'){
a[count] = a[count + 1];
count++;
... |
C | #include<arpa/inet.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int argc, char *argv[]) {
unsigned char buf[sizeof(struct in6_addr)];
int domain, s;
char str[INET6_ADDRSTRLEN];
if(argc != 3) {
fprintf(stderr, "Usage : %s {i4 | i6| <num> } string \n", argv[0]);
exit(EXIT_FAILURE);
}
do... |
C | #include "rsxtiny.h"
static s8 initialized = 0;
gcmConfiguration config;
void *heap_pointer;
extern void debugPrintf(const char* fmt, ...);
// Really dumb allocater, It will do until we start dealing with textures and vertex buffers.
void *rsxtiny_MemAlign(s32 alignment, s32 size) {
if (!initialized || al... |
C | #include "sparse_crs.h"
int init_pattern(struct PATTERN *pattern, int n, int m, int nzmax)
{
int i, j;
pattern->n = n;
pattern->m = m;
if ((pattern->row = (int*)malloc(sizeof(int) * (n + 1))) == NULL ||
(pattern->col = (int*)malloc(sizeof(int) * (n * nzmax))) == NULL)
{
printf ("Out of memory!\n"... |
C | #include "todo.h"
/**
* Just like fgets except it omits the newline at the end if there is one! Check out the man page for fgets!
*/
char *fgets_no_newline(char *buffer, int buf_length, FILE *stream) {
char *result = fgets(buffer, buf_length, stream);
if (result == NULL) {
return 0;
}
int lin... |
C | #include <stdio.h>
#include<string.h>
#include<math.h>
#define MAX 5000
int dp[MAX+1][MAX+1];
int LCS(char a[],char b[],int n,int m)
{
if(n==0||m==0)
return 0;
if(dp[n][m]!=-1)
return dp[n][m];
if(a[n-1]==b[m-1])
return dp[n][m]=1+LCS(a,b,n-1,m-1);
else
return dp[n][m]=... |
C | #pragma once
// 3.2.c
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define MAX(x,y) ((x > y) ? x : y)
#define MIN(x,y) ((x < y) ? x : y)
#define SUM_OF_ANGLES 180
#define RIGHT_ANGLE 90
//--------------------------------------------------------------------------------------------
// Identify The Trian... |
C | #include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<string.h>
int main()
{
FILE *fp = fopen("./tmp.txt","w+");
if(fp == NULL)
{
perror("fopen error");
return -1;
}
fseek(fp,10,SEEK_END);
char * ptr = "今天天气很好\n";
// char ptr[] = "冬天适合睡懒觉\n";
int ret = fwrite(ptr,1,strlen(ptr),fp);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TRUE 1
#define FALSE (!TRUE)
#define SIZE_STACK 100
typedef int EType;
typedef struct stack Stack;
struct stack {
int top;
EType elems[SIZE_STACK];
};
void initStack(Stack* stack);
int isEmpty(Stack* stack);
int isFull(Stack* stack);
int push(... |
C | #include<stdio.h>
#include<math.h>
void main()
{
int percent;
printf("\nType percentage: ");
scanf("%d",&percent);
while(percent>100)
{
printf("give your correct percentage");
scanf("%d",&percent);
}
switch(percent/10)
{
case 0:
case 1:
case 2:printf("\n fail");break;
case ... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
//Ѱҵ
//һֻdzһΣֶΡ
//дһҳֻһε֡
int main()
{
int arr[] = { 1, 1, 2, 2, 3, 3, 4, 5 };
int size = sizeof(arr) / sizeof(arr[0]);
int i, j;
//ѭÿѡȡһԪ
for (i = 0; i < size; i++)
{
//ѭԪѡȡǸԪؽбȽ
for (j = 0; j < size; j++)
{
if (i != j && arr[i] == arr[j])
{
bre... |
C | #include <stdio.h>
#include <assert.h>
#define MAXLINE 5
int romanToArabic( char *roman );
char* transformString(char s[], int size);
int returnnumb( char *roman, int y, int x, int lpctr);
void test();
int main(int argc, char **argv){
if( argc==2 ){
/*printf("The roman numeral %s is equal to %... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Struct - this is the struct of the information
* that an account have. It collects the information of
* the customer in the bank.
*
*/
struct
{
char accountNumber[20];
char pinCode[20];
int balance;
char name[20];
char sex[10];
}informat... |
C | #include <stdio.h>
#define N 10
int main(int argc, char *argv[])
{
int a,i,j,f[N]={0};
while(scanf("%d",&a)!=EOF)
{
for(i=0;a!=0;i++)
{
f[i]=a%10;
a=a/10;
}
for(j=0;j<=i-1;j++) printf("%d ",f[j]);
}
return 0;
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct node
{
int data;
struct node *next;
}s_noode;
void main()
{
struct node *n1,*n2;
printf("enter the number \n");
n1= (s_noode*)malloc(sizeof( s_noode));
scanf("%d",&n1->data);
printf("enter the second the number : \n");
n2=(s_noode*)mallo... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int arr1[10] = {1, 0, 0, 1, 0, 1, 1, 1, 0, 1};
int arr2[10] = {0, 0, 1, 1, 1, 1, 0, 0, 0, 1};
int arr3[10] = {0};
for(int i = 0; i < 10; i++) {
arr3[i] = arr1[i] & arr2[i];
}
for(int i = 0; i < 10; i++) {
printf("%d\n", arr3[... |
C | // Login Signup module
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct login_signup *ls;
struct login_signup
{
char name[30], email[30],dob[10],pwd[40],cnfrm_pwd[40], father[30];
char city[30];
int age;
char mobile[10], whatsup[10];
}details[2];
void signup(int);
void login(ls,char*, char*,... |
C | #include <stdio.h>
#include <stdlib.h>
/*
* usando variaveis - do tipo char
* desenvolvido por Caio Marcandali
* 02/05/2016
*/
int main(int argc, char *argv[]) {
//declarando uma variavel do tipo char ( tabela ascii)
//nome -> nome da variavel [30] aceuta ate 30 caracteres
char nome[30];
printf("digite ... |
C | //sum of all numbers between m and n
#include<stdio.h>
int main()
{
int i,n,m,sum=0;
printf("\nEnter first number : ");
scanf("%d",&n);
printf("\nEnter second number : ");
scanf("%d",&m);
for(i=n;i<=m;i++)
sum=sum+i;
printf("\nSum of numbers between %d and %d is : %d \n",n,m,sum);
return 0;
} |
C | #include <stdio.h>
int
main ()
{
int x = 3;
printf ("Hello\n");
x = x + 1;
printf ("x is %d\n", x);
x = x - 2;
printf ("bye");
return 0;
}
|
C | #include "buzzer.h"
TIM_HandleTypeDef htimer2;
uint8_t buzzer_melody; // This variable storage number of buzzer melody. Param: @BUZZER_MELODY
volatile uint32_t buzzer_freq; // This variable storage number of buzzer frequency. Param: @BUZZER_FREQUENCY
/*
* @fn - buzzer_init
*
* @return - Non... |
C | #include<stdio.h>
int isPalindrome(char *arr,int size)
{
int start=0;
int end=size-1;
int i=0;
for(;i<(size/2);i++)
{
if(arr[start]!=arr[end])
{
return -1;
}
start++;
end--;
}
return 1;
}
|
C | #include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <time.h>
// Forward Declarations
int install_handler(int sig, void (*handler)(int));
void sigint_handler(int sig);
void sigtstp_handler(int sig);
void sigquit_handler(int sig);
int read_and_ec... |
C | #include <stdio.h>
int main(){
double m, a, t, vel, espaco, trabalho;
scanf("%lf", &m);
scanf("%lf", &a);
scanf("%lf", &t);
vel= a * t * 3.6;
espaco= (a * t * t) / 2;
trabalho= ((m * 1000) * (a * t) * (a * t)) / 2;
printf("VELOCIDADE = %.2lf \n", vel);
printf("ESPACO PERCORRIDO = %.2lf \n", espaco);
printf("TRABALH... |
C | int putchar(int i);
void print(char *s) {
while (*s != '\0') {
putchar((int) *s);
s++;
}
}
void _start()
{
print("Hello, world\n");
}
|
C | #include<stdio.h>
#include<string.h>
void main() {
char info[20];
printf("Input : ");
scanf("%[^\n]",info);
printf("Output : ");
printf("%ld\n",strlen(info));
}
/*
* Input : India is my
Output : 11
*/
|
C | #include <stdio.h>
#define K 10
int matrix[K][K] =
{
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 9, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 8, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 7, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 6, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 5, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 4, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 3, 0, 0, 0, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.